aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-19 17:39:30 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:53:29 +0200
commitafb0664623c7b345f8ae5e57a07801c937be114b (patch)
tree0495414ef1dcaa50d5503c447afb3dc2470ad8d5 /libavformat
parentbe62e519435b7995cc551740e3dd81c7d3c96ef4 (diff)
downloadffmpeg-afb0664623c7b345f8ae5e57a07801c937be114b.tar.gz
avformat/mvi: Check count for overflow
Fixes: left shift of 21378748 by 10 places cannot be represented in type 'int' Fixes: 26449/clusterfuzz-testcase-minimized-ffmpeg_dem_MVI_fuzzer-5680463374712832 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit a413ed98632127342ad04b26e0ba0dc26adb70c9) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mvi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/mvi.c b/libavformat/mvi.c
index 9f90faf56b..1e2a08b44c 100644
--- a/libavformat/mvi.c
+++ b/libavformat/mvi.c
@@ -122,6 +122,8 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
count = (mvi->audio_size_counter + mvi->audio_frame_size + 512) >> MVI_FRAC_BITS;
if (count > mvi->audio_size_left)
count = mvi->audio_size_left;
+ if ((int64_t)count << MVI_FRAC_BITS > INT_MAX)
+ return AVERROR_INVALIDDATA;
if ((ret = av_get_packet(pb, pkt, count)) < 0)
return ret;
pkt->stream_index = MVI_AUDIO_STREAM_INDEX;