[FFmpeg-cvslog] avformat/mov: ignore samples overflowing next_root_atom

Alexandre Sicard git at videolan.org
Wed Jun 12 01:45:57 CEST 2013


ffmpeg | branch: master | Alexandre Sicard <alexandre.sicard at smartjog.com> | Tue Jun 11 11:06:38 2013 +0200| [b1d61eb7aaaef84391130b6f5e83942cc829a8c8] | committer: Michael Niedermayer

avformat/mov: ignore samples overflowing next_root_atom

This fixes #2657.
ISML movies produced by Microsoft Expression Encoder 4 seem to have invalid
sample entries in their trun/tfhd for data tracks. As a result, too much bytes
are read for these tracks to the point that next_root_atom can go out of
buffer, which makes the encoding fail if the input is not seekable.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b1d61eb7aaaef84391130b6f5e83942cc829a8c8
---

 libavformat/mov.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 407b52f..5c61f6c 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3276,6 +3276,11 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
     /* must be done just before reading, to avoid infinite loop on sample */
     sc->current_sample++;
 
+    if (mov->next_root_atom) {
+        sample->pos = FFMIN(sample->pos, mov->next_root_atom);
+        sample->size = FFMIN(sample->size, (mov->next_root_atom - sample->pos));
+    }
+
     if (st->discard != AVDISCARD_ALL) {
         if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
             av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n",



More information about the ffmpeg-cvslog mailing list