aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-06-03 03:17:27 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-06-12 00:39:13 +0200
commit0c977d37aad609f6ed7d148c012da8bc83df8f0b (patch)
tree6a084f5a7893b0b8337df93a29b530c887111c6e /libavformat/mov.c
parent019fce18bb0628ac8bc47a81d647a23d604b6123 (diff)
downloadffmpeg-0c977d37aad609f6ed7d148c012da8bc83df8f0b.tar.gz
avformat/mov: Use 64bit in intermediate for current_dts
Fixes: CID1500304 Unintentional integer overflow Fixes: CID1500318 Unintentional integer overflow Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 160e9626d7..61071faf4d 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3389,12 +3389,12 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
corrected_dts += sample_duration * sample_count;
}
- current_dts += sc->stts_data[i].duration * sample_count;
+ current_dts += sc->stts_data[i].duration * (int64_t)sample_count;
if (current_dts > corrected_dts) {
int64_t drift = (current_dts - corrected_dts)/FFMAX(sample_count, 1);
uint32_t correction = (sc->stts_data[i].duration > drift) ? drift : sc->stts_data[i].duration - 1;
- current_dts -= correction * sample_count;
+ current_dts -= correction * (uint64_t)sample_count;
sc->stts_data[i].duration -= correction;
}