提交 76133d7c 编写于 作者: M Michael Niedermayer

avformat/vividas: Fix memleak of AVIOContext in track_header()

Fixes: memleak
Fixes: 16127/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5649290914955264

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: NMichael Niedermayer <michael@niedermayer.cc>
上级 58e084bd
......@@ -375,15 +375,19 @@ static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *
num_data = avio_r8(pb);
for (j = 0; j < num_data; j++) {
uint64_t len = ffio_read_varlen(pb);
if (len > INT_MAX/2 - xd_size)
if (len > INT_MAX/2 - xd_size) {
av_free(pb);
return AVERROR_INVALIDDATA;
}
data_len[j] = len;
xd_size += len;
}
st->codecpar->extradata_size = 64 + xd_size + xd_size / 255;
if (ff_alloc_extradata(st->codecpar, st->codecpar->extradata_size))
if (ff_alloc_extradata(st->codecpar, st->codecpar->extradata_size)) {
av_free(pb);
return AVERROR(ENOMEM);
}
p = st->codecpar->extradata;
p[0] = 2;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册