[FFmpeg-cvslog] r10416 - trunk/libavcodec/h264.c

benoit subversion
Wed Sep 5 22:04:09 CEST 2007


Author: benoit
Date: Wed Sep  5 22:04:09 2007
New Revision: 10416

Log:
Avoid a crash when H264 MMC operation causes the short term reference
list to be emptied.
Patch by Jeff Downs: [heydowns borg com]


Modified:
   trunk/libavcodec/h264.c

Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c	(original)
+++ trunk/libavcodec/h264.c	Wed Sep  5 22:04:09 2007
@@ -3159,8 +3159,8 @@ static Picture * remove_short(H264Contex
             av_log(h->s.avctx, AV_LOG_DEBUG, "%d %d %p\n", i, pic->frame_num, pic);
         if(pic->frame_num == frame_num){
             h->short_ref[i]= NULL;
-            memmove(&h->short_ref[i], &h->short_ref[i+1], (h->short_ref_count - i - 1)*sizeof(Picture*));
-            h->short_ref_count--;
+            if (--h->short_ref_count)
+                memmove(&h->short_ref[i], &h->short_ref[i+1], (h->short_ref_count - i)*sizeof(Picture*));
             return pic;
         }
     }




More information about the ffmpeg-cvslog mailing list