avformat/matroskadec: Fix undefined shift in read_sint()
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 1 Jul 2015 09:59:57 +0000 (11:59 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 1 Jul 2015 10:00:43 +0000 (12:00 +0200)
Fixes: asan_heap-oob_17212bc_2243_cov_594210248_h264_TTA.mkv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/matroskadec.c

index 07f4539..9247a75 100644 (file)
@@ -806,7 +806,7 @@ static int ebml_read_sint(AVIOContext *pb, int size, int64_t *num)
 
         /* big-endian ordering; build up number */
         while (n++ < size)
-            *num = (*num << 8) | avio_r8(pb);
+            *num = ((uint64_t)*num << 8) | avio_r8(pb);
     }
 
     return 0;