summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavformat/voc.h2
-rw-r--r--libavformat/vocdec.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/voc.h b/libavformat/voc.h
index 7993146f47..3f995ad31f 100644
--- a/libavformat/voc.h
+++ b/libavformat/voc.h
@@ -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 {
diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c
index 94fbd7b9bf..246dbd91b4 100644
--- a/libavformat/vocdec.c
+++ b/libavformat/vocdec.c
@@ -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) {