]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/utils: Check bits_per_coded_sample
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 18 Jun 2019 21:55:56 +0000 (23:55 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 26 Jun 2019 19:41:53 +0000 (21:41 +0200)
This avoids the need for each decoder separately having to handle this case

Fixes: shift exponent -100663046 is negative
Fixes: out of array access
Fixes: 15270/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5727829913763840
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/utils.c

index cc04b7347122c839f09ee03115ecda0e501a54da..1b1feca38c5cf966c2f9a63d392b29744128911e 100644 (file)
@@ -962,6 +962,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
             ret = AVERROR(EINVAL);
             goto free_and_end;
         }
+        if (avctx->bits_per_coded_sample < 0) {
+            ret = AVERROR(EINVAL);
+            goto free_and_end;
+        }
         if (avctx->sub_charenc) {
             if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) {
                 av_log(avctx, AV_LOG_ERROR, "Character encoding is only "