[FFmpeg-cvslog] caf: fix 'pakt' chunk parsing

Justin Ruggles git at videolan.org
Thu Jul 19 23:35:47 CEST 2012


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Mon Jul  9 14:10:52 2012 -0400| [f5a9c35f886508b851011b7dd4ec18cc67b57d37] | committer: Justin Ruggles

caf: fix 'pakt' chunk parsing

according to the CAF specification:
"... the value for mChunkSize can be greater than the actual valid content
of the packet table chunk"

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

 libavformat/cafdec.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 4a04cb0..90e97a1 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -192,10 +192,11 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
         st->duration += caf->frames_per_packet ? caf->frames_per_packet : ff_mp4_read_descr_len(pb);
     }
 
-    if (avio_tell(pb) - ccount != size) {
+    if (avio_tell(pb) - ccount > size) {
         av_log(s, AV_LOG_ERROR, "error reading packet table\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
+    avio_skip(pb, ccount + size - avio_tell(pb));
 
     caf->num_bytes = pos;
     return 0;



More information about the ffmpeg-cvslog mailing list