[FFmpeg-devel] [PATCH] cdxl: Fix audio in robots.xl

Michael Niedermayer michaelni at gmx.at
Thu Feb 16 03:02:00 CET 2012


Fixes http://www.datafilehost.com/get.php?file=c9180074

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavformat/cdxl.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavformat/cdxl.c b/libavformat/cdxl.c
index f2956dd..e4a19d2 100644
--- a/libavformat/cdxl.c
+++ b/libavformat/cdxl.c
@@ -64,7 +64,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
     AVIOContext *pb = s->pb;
     uint32_t current_size;
     uint16_t audio_size, palette_size;
-    int32_t  video_size;
+    uint32_t video_size;
     int64_t  pos;
     int      ret;
 
@@ -83,12 +83,12 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
     current_size = AV_RB32(&cdxl->header[2]);
     palette_size = AV_RB16(&cdxl->header[20]);
     audio_size   = AV_RB16(&cdxl->header[22]);
+    video_size   = palette_size + (AV_RB16(&cdxl->header[14])+15)/16*2 * cdxl->header[19] * AV_RB16(&cdxl->header[16]);
 
     if (palette_size > 512)
         return AVERROR_INVALIDDATA;
-    if (current_size < audio_size + palette_size + CDXL_HEADER_SIZE)
+    if (current_size < (uint64_t)video_size + audio_size + CDXL_HEADER_SIZE)
         return AVERROR_INVALIDDATA;
-    video_size   = current_size - audio_size - CDXL_HEADER_SIZE;
 
     if (cdxl->read_chunk && audio_size) {
         if (cdxl->audio_stream_index == -1) {
@@ -141,6 +141,9 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt)
         cdxl->read_chunk   = audio_size;
     }
 
+    if (!audio_size || !cdxl->read_chunk)
+        avio_skip(pb, current_size - audio_size - video_size - CDXL_HEADER_SIZE);
+
     return ret;
 }
 
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list