diff options
author | Nikolas Bowe <nbowe-at-google.com@ffmpeg.org> | 2018-01-18 15:21:56 -0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-02-19 02:40:54 +0100 |
commit | 9d0b3fa58c4b12cb0203440f9c2d5f172d4f1792 (patch) | |
tree | f026bce0867cda1e88a70bda700adfee45ac7f41 | |
parent | e858326086c60a9820db7977666515787ce244ed (diff) | |
download | ffmpeg-9d0b3fa58c4b12cb0203440f9c2d5f172d4f1792.tar.gz |
avformat/matroskadec: Fix float-cast-overflow undefined behavior in matroska_parse_tracks()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit e07649e618caedc07eaf2f4d09253de7f77d14f0)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/matroskadec.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 76b9c8d0c2..0451c33fe7 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1782,8 +1782,16 @@ static int matroska_parse_tracks(AVFormatContext *s) } if (track->type == MATROSKA_TRACK_TYPE_VIDEO) { - if (!track->default_duration && track->video.frame_rate > 0) - track->default_duration = 1000000000 / track->video.frame_rate; + if (!track->default_duration && track->video.frame_rate > 0) { + double default_duration = 1000000000 / track->video.frame_rate; + if (default_duration > UINT64_MAX || default_duration < 0) { + av_log(matroska->ctx, AV_LOG_WARNING, + "Invalid frame rate %e. Cannot calculate default duration.\n", + track->video.frame_rate); + } else { + track->default_duration = default_duration; + } + } if (track->video.display_width == -1) track->video.display_width = track->video.pixel_width; if (track->video.display_height == -1) |