Determine VOC block length when length field is zero, fixes issue1538.
authorPeter Ross <pross@xvid.org>
Tue, 24 Nov 2009 07:08:17 +0000 (07:08 +0000)
committerPeter Ross <pross@xvid.org>
Tue, 24 Nov 2009 07:08:17 +0000 (07:08 +0000)
Originally committed as revision 20596 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/voc.h
libavformat/vocdec.c

index 7993146..3f995ad 100644 (file)
@@ -26,7 +26,7 @@
 #include "riff.h"    /* for CodecTag */
 
 typedef struct voc_dec_context {
-    int remaining_size;
+    int64_t remaining_size;
 } VocDecContext;
 
 typedef enum voc_type {
index 94fbd7b..246dbd9 100644 (file)
@@ -76,6 +76,11 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
         if (type == VOC_TYPE_EOF)
             return AVERROR(EIO);
         voc->remaining_size = get_le24(pb);
+        if (!voc->remaining_size) {
+            if (url_is_streamed(s->pb))
+                return AVERROR(EIO);
+            voc->remaining_size = url_fsize(pb) - url_ftell(pb);
+        }
         max_size -= 4;
 
         switch (type) {