aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-06-16 16:12:42 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-14 23:30:37 +0100
commitfb81fd52d35565439592cd616c5680601a137cf9 (patch)
treecf7f48a415cbdd287f0b114783e5b19220f8c013
parent0409e5fe361cc8dc9c4150012cd9b67ed60499d2 (diff)
downloadffmpeg-fb81fd52d35565439592cd616c5680601a137cf9.tar.gz
avcodec/ffwavesynth: Check ts_end - ts_start for overflow
Fixes: signed integer overflow: 2314885530818453536 - -8926099139098304480 cannot be represented in type 'long' Fixes: 15259/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5764366093254656 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 2db7a3bc4acdd293ed10b71e55f16a45ca28b629) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/ffwavesynth.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c
index 9d055e4019..a66113972b 100644
--- a/libavcodec/ffwavesynth.c
+++ b/libavcodec/ffwavesynth.c
@@ -267,7 +267,10 @@ static int wavesynth_parse_extradata(AVCodecContext *avc)
in->type = AV_RL32(edata + 16);
in->channels = AV_RL32(edata + 20);
edata += 24;
- if (in->ts_start < cur_ts || in->ts_end <= in->ts_start)
+ if (in->ts_start < cur_ts ||
+ in->ts_end <= in->ts_start ||
+ (uint64_t)in->ts_end - in->ts_start > INT64_MAX
+ )
return AVERROR(EINVAL);
cur_ts = in->ts_start;
dt = in->ts_end - in->ts_start;