]> git.sesse.net Git - ffmpeg/commitdiff
avformat/nistspheredec: Check bps
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 19 Oct 2020 08:53:31 +0000 (10:53 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 24 Oct 2020 17:11:12 +0000 (19:11 +0200)
Fixes: left shift of 1111111190 by 3 places cannot be represented in type 'int'
Fixes: 26437/clusterfuzz-testcase-minimized-ffmpeg_dem_NISTSPHERE_fuzzer-4886896091856896
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/nistspheredec.c

index 3ef3843d5e1e21401a9c07098586bca4dc99e064..079369929f096d115957e0942fa4d12b86f6e3ba 100644 (file)
@@ -109,6 +109,8 @@ static int nist_read_header(AVFormatContext *s)
             sscanf(buffer, "%*s %*s %"SCNd64, &st->duration);
         } else if (!memcmp(buffer, "sample_n_bytes", 14)) {
             sscanf(buffer, "%*s %*s %d", &bps);
+            if (bps > INT_MAX/8U)
+                return AVERROR_INVALIDDATA;
         } else if (!memcmp(buffer, "sample_rate", 11)) {
             sscanf(buffer, "%*s %*s %d", &st->codecpar->sample_rate);
         } else if (!memcmp(buffer, "sample_sig_bits", 15)) {