aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mvdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-09-15 22:00:46 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-05 23:19:39 +0200
commit2a7b3e62e0274f359ee1420f1d765292beb0508b (patch)
tree0fb62c81074c32dc06a589f7a82c5d3a06722ee0 /libavformat/mvdec.c
parent1d2a3988270faa0dff5a3eff500d71c01789bf29 (diff)
downloadffmpeg-2a7b3e62e0274f359ee1420f1d765292beb0508b.tar.gz
avformat/mvdec: Do not set invalid sample rate
Fixes: signed integer overflow: -682581959642593728 * 16 cannot be represented in type 'long' Fixes: 37883/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5311691517198336 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 737e6bf2162b89d396f4d477bfe8c99f1dd885de) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mvdec.c')
-rw-r--r--libavformat/mvdec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index b833abfa19..ab7bc5a328 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -156,9 +156,10 @@ static int parse_audio_var(AVFormatContext *avctx, AVStream *st,
} else if (!strcmp(name, "NUM_CHANNELS")) {
return set_channels(avctx, st, var_read_int(pb, size));
} else if (!strcmp(name, "SAMPLE_RATE")) {
- st->codecpar->sample_rate = var_read_int(pb, size);
- if (st->codecpar->sample_rate <= 0)
+ int sample_rate = var_read_int(pb, size);
+ if (sample_rate <= 0)
return AVERROR_INVALIDDATA;
+ st->codecpar->sample_rate = sample_rate;
avpriv_set_pts_info(st, 33, 1, st->codecpar->sample_rate);
} else if (!strcmp(name, "SAMPLE_WIDTH")) {
uint64_t bpc = var_read_int(pb, size) * (uint64_t)8;