mov: Seek back if overreading an individual atom
authorMartin Storsjö <martin@martin.st>
Mon, 15 Jul 2013 12:59:50 +0000 (15:59 +0300)
committerLuca Barbato <lu_zero@gentoo.org>
Mon, 28 Oct 2013 13:16:37 +0000 (14:16 +0100)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Cc: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 5b4eb243bce10a3e8345401a353749e0414c54ca)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Conflicts:
libavformat/mov.c

libavformat/mov.c

index 0e5d473..9cac506 100644 (file)
@@ -357,6 +357,12 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
             left = a.size - avio_tell(pb) + start_pos;
             if (left > 0) /* skip garbage at atom end */
                 avio_skip(pb, left);
+            else if (left < 0) {
+                av_log(c->fc, AV_LOG_WARNING,
+                       "overread end of atom '%.4s' by %"PRId64" bytes\n",
+                       (char*)&a.type, -left);
+                avio_seek(pb, left, SEEK_CUR);
+            }
         }
 
         total_size += a.size;