diff mbox series

[FFmpeg-devel,7/7] avformat/nistspheredec: Check bps

Message ID 20201019142501.6867-7-michael@niedermayer.cc
State Accepted
Commit 7c144b363e67bef7651108c88687b38155172c1f
Headers show
Series [FFmpeg-devel,1/7] avcodec/fits: Check bscale
Related show

Checks

Context Check Description
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate warning Make fate failed
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Michael Niedermayer Oct. 19, 2020, 2:25 p.m. UTC
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 | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael Niedermayer Oct. 24, 2020, 5:09 p.m. UTC | #1
On Mon, Oct 19, 2020 at 04:25:01PM +0200, Michael Niedermayer wrote:
> 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 | 2 ++
>  1 file changed, 2 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/nistspheredec.c b/libavformat/nistspheredec.c
index 3ef3843d5e..079369929f 100644
--- a/libavformat/nistspheredec.c
+++ b/libavformat/nistspheredec.c
@@ -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)) {