[SCM] libav/wheezy-security: h264: reset ref count if decoding the slice header fails

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 35ba079fbf281a066f3ac1e1271f3caa402dcd74
Author: Anton Khirnov <anton at khirnov.net>
Date:   Thu Nov 28 10:54:35 2013 +0100

    h264: reset ref count if decoding the slice header fails
    
    Otherwise the ER code might try to use some already freed references.
    
    Fixes possible access to freed memory.
    
    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 e88bb93..1c2f23a 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -4118,9 +4118,10 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
             context_count = 0;
         }
 
-        if (err < 0)
+        if (err < 0) {
             av_log(h->s.avctx, AV_LOG_ERROR, "decode_slice_header error\n");
-        else if(err == 1) {
+            h->ref_count[0] = h->ref_count[1] = h->list_count = 0;
+        } else if (err == 1) {
             /* Slice could not be decoded in parallel mode, copy down
              * NAL unit stuff to context 0 and restart. Note that
              * rbsp_buffer is not transferred, but since we no longer

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list