Check return value of frame_start(), this avoids a crash if AVCodecContext::get_buffe...
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 22 Feb 2009 09:51:58 +0000 (09:51 +0000)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 22 Feb 2009 09:51:58 +0000 (09:51 +0000)
Not sure if returning -1 is the best possible solution but at least avoids the crash.

Originally committed as revision 17520 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/h264.c

index 372adb9..5339ed0 100644 (file)
@@ -3792,7 +3792,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
         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);
         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;
             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;