mirror of https://git.ffmpeg.org/ffmpeg.git
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 bcbe4f3ceb
)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
0b0f1cd44e
commit
de75bc01cd
|
@ -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;
|
||||
|
@ -191,6 +193,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);
|
||||
|
|
Loading…
Reference in New Issue