]> git.sesse.net Git - ffmpeg/commitdiff
wmalosslessdec: Fix reading too many bits in decode_channel_residues()
authorAnton Khirnov <anton@khirnov.net>
Sat, 29 Sep 2012 17:16:32 +0000 (19:16 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sat, 29 Sep 2012 17:16:32 +0000 (19:16 +0200)
Fixes a part of CVE-2012-2795

CC:libav-stable@libav.org

Based on a patch by Michael Niedermayer <michaelni@gmx.at>

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
libavcodec/wmalosslessdec.c

index dc83b0607bfd0dcda6a24dd6cdab46df4b3a1750..b97f39752c9450bc373de59bbf1a0ee17fc88863 100644 (file)
@@ -520,7 +520,7 @@ static int decode_channel_residues(WmallDecodeCtx *s, int ch, int tile_size)
             residue = quo;
         else {
             rem_bits = av_ceil_log2(ave_mean);
-            rem      = rem_bits ? get_bits(&s->gb, rem_bits) : 0;
+            rem      = rem_bits ? get_bits_long(&s->gb, rem_bits) : 0;
             residue  = (quo << rem_bits) + rem;
         }