avcodec/svq3: fix slice size check
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 20 Aug 2016 20:09:54 +0000 (22:09 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 25 Aug 2016 01:29:36 +0000 (03:29 +0200)
Fixes out of array read
Fixes: 09f46aa2175cade93e3e3932646a56a9/asan_heap-oob_4a5385_2995_498f6abfdc0248288cefe5f4b7ad316c.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2624695484cde26baedac10192856ebfd97f2cc7)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/svq3.c

index a927063..5e7d164 100644 (file)
@@ -1027,7 +1027,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
         slice_bits   = slice_length * 8;
         slice_bytes  = slice_length + length - 1;
 
-        if (slice_bytes > get_bits_left(&s->gb)) {
+        if (8LL*slice_bytes > get_bits_left(&s->gb)) {
             av_log(avctx, AV_LOG_ERROR, "slice after bitstream end\n");
             return -1;
         }