]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mvi: Check count for overflow
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 19 Oct 2020 15:39:30 +0000 (17:39 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 24 Oct 2020 17:11:12 +0000 (19:11 +0200)
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>
libavformat/mvi.c

index ff5c08bf51148e7175950bf3e0aba35d55b96873..06c9cfe3f057c4c5ae5ec136e39f2d62d99b41ad 100644 (file)
@@ -123,6 +123,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;