diff mbox

[FFmpeg-devel,06/12] mov: validate sidx timescale

Message ID 51c74359-03d8-9a80-6126-3818e131a8c6@googlemail.com
State Accepted
Commit 9d36602abc4ef5b69b92feadf868c77e5e9ccc7d
Headers show

Commit Message

Andreas Cadhalpun Oct. 23, 2016, 4:29 p.m. UTC
A negative timescale doesn't make sense and triggers assertions in
av_rescale_rnd.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
---
 libavformat/mov.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6f313a5..413675f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4233,6 +4233,11 @@  static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     timescale = av_make_q(1, avio_rb32(pb));
 
+    if (timescale.den <= 0) {
+        av_log(c->fc, AV_LOG_ERROR, "Invalid sidx timescale 1/%d\n", timescale.den);
+        return AVERROR_INVALIDDATA;
+    }
+
     if (version == 0) {
         pts = avio_rb32(pb);
         offset += avio_rb32(pb);