summaryrefslogtreecommitdiff
path: root/libavformat/idroqdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-19 13:33:25 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-19 13:34:25 +0200
commit52dc3600a901d86cb3a4723f108cea04a594443f (patch)
tree99b817d5e4726242dce3fd7adbac92529049d8e1 /libavformat/idroqdec.c
parentb4c88a4c4ceae7faa66ea6b4fc66b696a597976e (diff)
parentbcbe4f3ceb6ee0210d3a401963518906c8b9b230 (diff)
Merge commit 'bcbe4f3ceb6ee0210d3a401963518906c8b9b230'
* commit 'bcbe4f3ceb6ee0210d3a401963518906c8b9b230': idroqdec: Make sure a video stream has been allocated before returning packets Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/idroqdec.c')
-rw-r--r--libavformat/idroqdec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index 6f843d7bc9..8cdd72e33a 100644
--- a/libavformat/idroqdec.c
+++ b/libavformat/idroqdec.c
@@ -145,6 +145,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;
@@ -194,6 +196,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);