[FFmpeg-cvslog] avformat/sdsdec: Use av_rescale() to avoid intermediate overflow in duration calculation
Michael Niedermayer
git at videolan.org
Sun Oct 9 23:07:58 EEST 2022
ffmpeg | branch: release/4.2 | Michael Niedermayer <michael at niedermayer.cc> | Sun Sep 18 16:42:21 2022 +0200| [3f283529f78b974962a867842df8d884b32d9c9e] | committer: Michael Niedermayer
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 at niedermayer.cc>
(cherry picked from commit aa8eb1bed075931b0ce0a8bc9a8ff5882830044c)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f283529f78b974962a867842df8d884b32d9c9e
---
libavformat/sdsdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/sdsdec.c b/libavformat/sdsdec.c
index 9c361cdff2..2f4056c8b3 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->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);
More information about the ffmpeg-cvslog
mailing list