diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-03-08 23:12:59 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-29 03:34:22 +0200 |
commit | 443fc852034b7d2971db6810c2a84f04e9da9a3f (patch) | |
tree | 5288c0a21d5ceb3de707be1e1f1eecbaf812c52d | |
parent | d81150929d35efc423b488e548d4dc881cde5dbd (diff) | |
download | ffmpeg-443fc852034b7d2971db6810c2a84f04e9da9a3f.tar.gz |
ffmdec: make sure the time base is valid
A negative time base can trigger assertions.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4c91d81be23ffacfa3897b2bcfa77445bb0c2f89)
Conflicts:
libavformat/ffmdec.c
-rw-r--r-- | libavformat/ffmdec.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index cbbac78526..9e5b562709 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -299,6 +299,12 @@ static int ffm2_read_header(AVFormatContext *s) case MKBETAG('S', 'T', 'V', 'I'): codec->time_base.num = avio_rb32(pb); codec->time_base.den = avio_rb32(pb); + if (codec->time_base.num <= 0 || codec->time_base.den <= 0) { + av_log(s, AV_LOG_ERROR, "Invalid time base %d/%d\n", + codec->time_base.num, codec->time_base.den); + ret = AVERROR_INVALIDDATA; + goto fail; + } codec->width = avio_rb16(pb); codec->height = avio_rb16(pb); codec->gop_size = avio_rb16(pb); @@ -423,6 +429,11 @@ static int ffm_read_header(AVFormatContext *s) case AVMEDIA_TYPE_VIDEO: codec->time_base.num = avio_rb32(pb); codec->time_base.den = avio_rb32(pb); + if (codec->time_base.num <= 0 || codec->time_base.den <= 0) { + av_log(s, AV_LOG_ERROR, "Invalid time base %d/%d\n", + codec->time_base.num, codec->time_base.den); + goto fail; + } codec->width = avio_rb16(pb); codec->height = avio_rb16(pb); codec->gop_size = avio_rb16(pb); |