aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-09-18 16:42:21 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-09-24 22:58:23 +0200
commite443e2e210bfa4edd9c44ecb34094229c9e709ea (patch)
treed2c0d8b590c8128dfa17216103a6f97c750550e3
parentad56da76348564ba4d1e862a348930517eea429b (diff)
downloadffmpeg-e443e2e210bfa4edd9c44ecb34094229c9e709ea.tar.gz
avformat/sdsdec: Use av_rescale() to avoid intermediate overflow in duration calculation
Fixes: signed integer overflow: 72128794995445727 * 240 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_SDS_fuzzer-6628185583779840 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 aa8eb1bed075931b0ce0a8bc9a8ff5882830044c) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/sdsdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/sdsdec.c b/libavformat/sdsdec.c
index f98096dca9..d296500bec 100644
--- a/libavformat/sdsdec.c
+++ b/libavformat/sdsdec.c
@@ -112,7 +112,7 @@ static int sds_read_header(AVFormatContext *ctx)
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->ch_layout.nb_channels = 1;
st->codecpar->sample_rate = sample_period ? 1000000000 / sample_period : 16000;
- st->duration = (avio_size(pb) - 21) / (127) * s->size / 4;
+ st->duration = av_rescale((avio_size(pb) - 21) / 127, s->size, 4);
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);