diff options
author | Martin Storsjö <martin@martin.st> | 2013-09-19 18:02:36 +0400 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-09-19 23:47:26 +0400 |
commit | d8798276b65543d921adadf63cc7f5ba2d1604af (patch) | |
tree | d28e3247df550df478c27337f9b8664738169b5e /libavformat/r3d.c | |
parent | 3ca14aa5964ea5d11f7a15f9fff17924d6096d44 (diff) |
r3d: Add more input value validation
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/r3d.c')
-rw-r--r-- | libavformat/r3d.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/r3d.c b/libavformat/r3d.c index 1da8b88d5b..74a1f2baa2 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -85,7 +85,7 @@ static int r3d_read_red1(AVFormatContext *s) framerate.num = avio_rb16(s->pb); framerate.den = avio_rb16(s->pb); - if (framerate.num && framerate.den) { + if (framerate.num > 0 && framerate.den > 0) { st->avg_frame_rate = framerate; } @@ -281,6 +281,10 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) dts = avio_rb32(s->pb); st->codec->sample_rate = avio_rb32(s->pb); + if (st->codec->sample_rate <= 0) { + av_log(s, AV_LOG_ERROR, "Bad sample rate\n"); + return AVERROR_INVALIDDATA; + } samples = avio_rb32(s->pb); |