aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-16 14:53:15 +0300
committerLuca Barbato <lu_zero@gentoo.org>2014-01-07 09:43:56 +0100
commit75dabbff8b15700c20e42f79a23fd4338a54e71d (patch)
tree210845fa452ae45afb176a93c16335eca7235875
parent3b169044ca042f1bc82a7e55bbf72062b051c75f (diff)
downloadffmpeg-75dabbff8b15700c20e42f79a23fd4338a54e71d.tar.gz
idroqdec: Make sure a video stream has been allocated before returning packets
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st> (cherry picked from commit bcbe4f3ceb6ee0210d3a401963518906c8b9b230) Signed-off-by: Luca Barbato <lu_zero@gentoo.org> (cherry picked from commit de75bc01cda53acfbd9f901639695ade8e650c43)
-rw-r--r--libavformat/idroqdec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index d63c395b79..ece18b8b4f 100644
--- a/libavformat/idroqdec.c
+++ b/libavformat/idroqdec.c
@@ -142,6 +142,8 @@ static int roq_read_packet(AVFormatContext *s,
break;
case RoQ_QUAD_CODEBOOK:
+ if (roq->video_stream_index < 0)
+ return AVERROR_INVALIDDATA;
/* packet needs to contain both this codebook and next VQ chunk */
codebook_offset = avio_tell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
codebook_size = chunk_size;
@@ -184,6 +186,11 @@ static int roq_read_packet(AVFormatContext *s,
st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample;
}
case RoQ_QUAD_VQ:
+ if (chunk_type == RoQ_QUAD_VQ) {
+ if (roq->video_stream_index < 0)
+ return AVERROR_INVALIDDATA;
+ }
+
/* load up the packet */
if (av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE))
return AVERROR(EIO);