aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolas Bowe <nbowe-at-google.com@ffmpeg.org>2018-01-18 15:21:56 -0800
committerMichael Niedermayer <michael@niedermayer.cc>2018-01-28 15:33:09 +0100
commitfacd0521e44063f8d8b57b11a4803ae82c0c123b (patch)
tree38ee22ef79527ead7f2fb0f7e78bf5a13fbaceb3
parent7b56d6584c46072b0f959f22a461cff01b302a65 (diff)
downloadffmpeg-facd0521e44063f8d8b57b11a4803ae82c0c123b.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.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 94a56ebfa7..e6631097b8 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2089,8 +2089,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)