diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-10-23 16:38:52 +0200 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2016-11-07 00:51:49 +0100 |
commit | a398f054fdb9b0f0b5a91c231fba6ce014143f71 (patch) | |
tree | c6b4e8582e13cfcf38656b3d7fb0b4655f627f3d /libavformat | |
parent | fc022e77eed66ccfd7ac1788ba23f790c6769dee (diff) | |
download | ffmpeg-a398f054fdb9b0f0b5a91c231fba6ce014143f71.tar.gz |
mov: validate time_scale
A negative timescale doesn't make sense and triggers assertions in
av_rescale_rnd.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mov.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index b6c8c29f91..5fb345a461 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1223,6 +1223,10 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) mov_metadata_creation_time(&st->metadata, creation_time); sc->time_scale = avio_rb32(pb); + if (sc->time_scale <= 0) { + av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d\n", sc->time_scale); + return AVERROR_INVALIDDATA; + } st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ lang = avio_rb16(pb); /* language */ @@ -1248,7 +1252,10 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) } mov_metadata_creation_time(&c->fc->metadata, creation_time); c->time_scale = avio_rb32(pb); /* time scale */ - + if (c->time_scale <= 0) { + av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d\n", c->time_scale); + return AVERROR_INVALIDDATA; + } av_log(c->fc, AV_LOG_TRACE, "time scale = %i\n", c->time_scale); c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ |