1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

libavformat/mov: limit nb_frames_for_fps to INT_MAX

It's this or add overflow detection in mov_read_header().

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Dan Sanders 2019-04-22 11:05:00 -07:00 committed by Michael Niedermayer
parent 4a69b18242
commit 22c820f509

View File

@ -2940,7 +2940,7 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (duration > 0 &&
duration <= INT64_MAX - sc->duration_for_fps &&
total_sample_count <= INT64_MAX - sc->nb_frames_for_fps
total_sample_count <= INT_MAX - sc->nb_frames_for_fps
) {
sc->duration_for_fps += duration;
sc->nb_frames_for_fps += total_sample_count;
@ -4897,7 +4897,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc->data_size += sample_size;
if (sample_duration <= INT64_MAX - sc->duration_for_fps &&
1 <= INT64_MAX - sc->nb_frames_for_fps
1 <= INT_MAX - sc->nb_frames_for_fps
) {
sc->duration_for_fps += sample_duration;
sc->nb_frames_for_fps ++;