summaryrefslogtreecommitdiff
path: root/libavformat/ffmdec.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-03-08 23:12:59 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-09 13:40:20 +0100
commit4c91d81be23ffacfa3897b2bcfa77445bb0c2f89 (patch)
tree5bffe46e2f2c499502dd141cdb0b41238aa45dda /libavformat/ffmdec.c
parentba0198a7672885dd120006cc730070ab3cad4a20 (diff)
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>
Diffstat (limited to 'libavformat/ffmdec.c')
-rw-r--r--libavformat/ffmdec.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 96527a3aa5..ee34e73451 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -331,6 +331,12 @@ static int ffm2_read_header(AVFormatContext *s)
}
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);
@@ -503,6 +509,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);