[SCM] libav/upstream.snapshot: wmapro: make sure there is room to store the current packet

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sat Jul 13 06:29:04 UTC 2013


The following commit has been merged in the upstream.snapshot branch:
commit 88433979c21ccaba3581acd397d091f2a50a6028
Author: Luca Barbato <lu_zero at gentoo.org>
Date:   Fri Jun 28 04:03:47 2013 +0200

    wmapro: make sure there is room to store the current packet
    
    Prevent horrid and hard to trace struct overwrite.
    
    Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
    CC: libav-stable at libav.org
    (cherry picked from commit e30b068ef79f604ff439418da07f7e2efd01d4ea)
    
    Signed-off-by: Reinhard Tartler <siretart at tauware.de>

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index efc8fce..8fabc3a 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1464,6 +1464,14 @@ static void save_bits(WMAProDecodeCtx *s, GetBitContext* gb, int len,
         return;
     }
 
+    if (len > put_bits_left(&s->pb)) {
+        av_log(s->avctx, AV_LOG_ERROR,
+               "Cannot append %d bits, only %d bits available.\n",
+               len, put_bits_left(&s->pb));
+        s->packet_loss = 1;
+        return;
+    }
+
     s->num_saved_bits += len;
     if (!append) {
         avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3),

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list