[SCM] libav/wheezy-security: h264: reset first_field if frame_start() fails for missing refs

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 1 21:36:12 UTC 2014


The following commit has been merged in the wheezy-security branch:
commit a7cce9ebf3ae3b9678970236c964900393603a73
Author: Anton Khirnov <anton at khirnov.net>
Date:   Thu Nov 28 10:54:35 2013 +0100

    h264: reset first_field if frame_start() fails for missing refs
    
    In this case we may not have a current frame, while first_field being
    set implies we do.
    
    Fixes invalid reads.
    
    Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
    CC:libav-stable at libav.org

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index de4a4f0..e88bb93 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2990,8 +2990,10 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
                h->frame_num != (h->prev_frame_num + 1) % (1 << h->sps.log2_max_frame_num)) {
             Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL;
             av_log(h->s.avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num);
-            if (ff_h264_frame_start(h) < 0)
+            if (ff_h264_frame_start(h) < 0) {
+                h0->s.first_field = 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;

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list