]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/alac: Check for bps of 0
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 8 Aug 2019 23:23:49 +0000 (01:23 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 26 Aug 2019 08:36:40 +0000 (10:36 +0200)
Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: 15764/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5102101203517440
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/alac.c

index 6086e2caa895881f4e7084bf6803f4ced9bc1506..782d461b227ee19fb1aa0e1fdc081e2646cfa492 100644 (file)
@@ -250,10 +250,12 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
 
     alac->extra_bits = get_bits(&alac->gb, 2) << 3;
     bps = alac->sample_size - alac->extra_bits + channels - 1;
-    if (bps > 32U) {
+    if (bps > 32) {
         avpriv_report_missing_feature(avctx, "bps %d", bps);
         return AVERROR_PATCHWELCOME;
     }
+    if (bps < 1)
+        return AVERROR_INVALIDDATA;
 
     /* whether the frame is compressed */
     is_compressed = !get_bits1(&alac->gb);