[FFmpeg-cvslog] h263dec: Prevent dimension changes from leaking on errors in header parsing .

Michael Niedermayer git at videolan.org
Wed Apr 18 21:26:37 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Apr 18 21:03:03 2012 +0200| [a02f8ef1d2f4cd267224c9bc3b5e841d7fc943cc] | committer: Michael Niedermayer

h263dec: Prevent dimension changes from leaking on errors in header parsing.

This fixes crashes with frame threads caused by inconsistent context parameters.

Fixes Ticket1207

Found-by: John Villamil
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a02f8ef1d2f4cd267224c9bc3b5e841d7fc943cc
---

 libavcodec/h263dec.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 8669d14..50699c7 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -438,6 +438,14 @@ retry:
         ret = ff_h263_decode_picture_header(s);
     }
 
+    if (HAVE_THREADS && (s->avctx->active_thread_type&FF_THREAD_FRAME) && ret < 0) {
+        if (   s->width  != avctx->coded_width
+            || s->height != avctx->coded_height) {
+                av_log(s->avctx, AV_LOG_WARNING, "Reverting picture dimensions change due to header decoding failure\n");
+                s->width = avctx->coded_width;
+                s->height= avctx->coded_height;
+        }
+    }
     if(ret==FRAME_SKIPPED) return get_consumed_bytes(s, buf_size);
 
     /* skip if the header was thrashed */



More information about the ffmpeg-cvslog mailing list