Mercurial > libavcodec.hg
changeset 5643:bf02fa211648 libavcodec
Avoid a crash when H264 MMC operation causes the short term reference
list to be emptied.
Patch by Jeff Downs: [heydowns borg com]
author | benoit |
---|---|
date | Wed, 05 Sep 2007 20:04:09 +0000 |
parents | d2598034f2a9 |
children | 679d6ccfffb0 |
files | h264.c |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/h264.c Wed Sep 05 16:18:15 2007 +0000 +++ b/h264.c Wed Sep 05 20:04:09 2007 +0000 @@ -3159,8 +3159,8 @@ 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; } }