avformat/oggparseogm: Check available data before reading global header

Fixes use of uninitialized data

Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2017-04-11 15:06:21 +02:00
parent cd8e62746f
commit 170d864d2c

View File

@ -108,6 +108,8 @@ ogm_header(AVFormatContext *s, int idx)
if (size > 52) {
av_assert0(AV_INPUT_BUFFER_PADDING_SIZE <= 52);
size -= 52;
if (bytestream2_get_bytes_left(&p) < size)
return AVERROR_INVALIDDATA;
ff_alloc_extradata(st->codecpar, size);
bytestream2_get_buffer(&p, st->codecpar->extradata, st->codecpar->extradata_size);
}