aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-02-02 20:47:10 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:20 +0200
commit00cc2e7df2a60f9166eae13766ba1ab729232d3e (patch)
tree21a83148b9ce0fd4fadcefe05cf17164d17d7750
parent6180a967b7f5473a5b4b816c000a2a1fae09724f (diff)
downloadffmpeg-00cc2e7df2a60f9166eae13766ba1ab729232d3e.tar.gz
avformat/mvdec: Sanity check SAMPLE_WIDTH
Fixes: signed integer overflow: 999999999 * 8 cannot be represented in type 'int' Fixes: 30048/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5864289917337600 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit ab82c105787fa81d1e35b9209f3d53e98be936a4) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mvdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index e7c743cd8e..de3931040a 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -159,7 +159,10 @@ static int parse_audio_var(AVFormatContext *avctx, AVStream *st,
st->codecpar->sample_rate = var_read_int(pb, size);
avpriv_set_pts_info(st, 33, 1, st->codecpar->sample_rate);
} else if (!strcmp(name, "SAMPLE_WIDTH")) {
- st->codecpar->bits_per_coded_sample = var_read_int(pb, size) * 8;
+ uint64_t bpc = var_read_int(pb, size) * (uint64_t)8;
+ if (bpc > 16)
+ return AVERROR_INVALIDDATA;
+ st->codecpar->bits_per_coded_sample = bpc;
} else
return AVERROR_INVALIDDATA;