[FFmpeg-devel] [PATCH] add forgotten check for frame_start() return value

Reimar Döffinger Reimar.Doeffinger
Wed Feb 18 11:25:27 CET 2009


Hello,
if get_buffer fails, the H.264 decoder may crash.
This patch fixes this by adding an obviously forgotten return value
check for frame_start:
Index: libavcodec/h264.c
===================================================================
--- libavcodec/h264.c   (revision 17395)
+++ libavcodec/h264.c   (working copy)
@@ -3797,7 +3797,8 @@
         while(h->frame_num !=  h->prev_frame_num &&
               h->frame_num != (h->prev_frame_num+1)%(1<<h->sps.log2_max_frame_num)){
             av_log(NULL, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num);
-            frame_start(h);
+            if (frame_start(h) < 0)
+                return -1;
             h->prev_frame_num++;
             h->prev_frame_num %= 1<<h->sps.log2_max_frame_num;
             s->current_picture_ptr->frame_num= h->prev_frame_num;


Greetings,
Reimar D?ffinger




More information about the ffmpeg-devel mailing list