summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-11-22 19:13:01 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-02-04 23:34:29 +0100
commit4f70e1ec0cfa8ae24b224faf522c1d6ca95a42f6 (patch)
treeb5f4bc4095e75bab010da3f4831e835804ab5539 /libavformat/mov.c
parent4dfb7ff528c02afbafba14676c139ecb82164c44 (diff)
avformat/mov: Use av_mul_q() to avoid integer overflows
Fixes: signed integer overflow: 538976288 * 538976288 cannot be represented in type 'int' Fixes: 27473/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5758978289827840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index ad0b9a58d3..8eacf2cc04 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2354,12 +2354,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (tmcd_ctx->tmcd_flags & 0x0008) {
int timescale = AV_RB32(st->codecpar->extradata + 8);
int framedur = AV_RB32(st->codecpar->extradata + 12);
- st->avg_frame_rate.num *= timescale;
- st->avg_frame_rate.den *= framedur;
+ st->avg_frame_rate = av_mul_q(st->avg_frame_rate, (AVRational){timescale, framedur});
#if FF_API_LAVF_AVCTX
FF_DISABLE_DEPRECATION_WARNINGS
- st->codec->time_base.den *= timescale;
- st->codec->time_base.num *= framedur;
+ st->codec->time_base = av_mul_q(st->codec->time_base , (AVRational){framedur, timescale});
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}