[FFmpeg-cvslog] h264: dont try to allocate scratchpad if linesize is not known

Michael Niedermayer git at videolan.org
Mon Dec 10 21:19:26 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Dec 10 20:51:32 2012 +0100| [c3bb3334f6837025fb23d5bcd29ba094aa368c6b] | committer: Michael Niedermayer

h264: dont try to allocate scratchpad if linesize is not known

Fixes out of array access

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/h264.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 6becfcb..86489ee 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1228,7 +1228,7 @@ static int decode_update_thread_context(AVCodecContext *dst,
 
     /* frame_start may not be called for the next thread (if it's decoding
      * a bottom field) so this has to be allocated here */
-    if (!h->bipred_scratchpad)
+    if (!h->bipred_scratchpad && s->linesize)
         h->bipred_scratchpad = av_malloc(16 * 6 * s->linesize);
 
     // extradata/NAL handling



More information about the ffmpeg-cvslog mailing list