mov: detect EOF in mov_read_dref()
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 18 Dec 2011 20:37:54 +0000 (21:37 +0100)
committerLuca Barbato <lu_zero@gentoo.org>
Sun, 16 Sep 2012 14:31:03 +0000 (16:31 +0200)
Avoid a near infinite loop.
Issue discovered by cosminamironesei.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavformat/mov.c

index 640377a134e54f0edebc12784150c0c9b61e99c0..09228cb011892d9f238013997744b80de4666185 100644 (file)
@@ -416,6 +416,8 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
             avio_skip(pb, 16);
 
             for (type = 0; type != -1 && avio_tell(pb) < next; ) {
+                if (pb->eof_reached)
+                    return AVERROR_EOF;
                 type = avio_rb16(pb);
                 len = avio_rb16(pb);
                 av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len);