Commit 15008db0 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/parser: Check next index validity in ff_combine_frame()

Fixes: out of array access
Fixes: 15522/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DNXHD_fuzzer-5747756078989312

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent bb326795
...@@ -245,6 +245,9 @@ int ff_combine_frame(ParseContext *pc, int next, ...@@ -245,6 +245,9 @@ int ff_combine_frame(ParseContext *pc, int next,
for (; pc->overread > 0; pc->overread--) for (; pc->overread > 0; pc->overread--)
pc->buffer[pc->index++] = pc->buffer[pc->overread_index++]; pc->buffer[pc->index++] = pc->buffer[pc->overread_index++];
if (next > *buf_size)
return AVERROR(EINVAL);
/* flush remaining if EOF */ /* flush remaining if EOF */
if (!*buf_size && next == END_NOT_FOUND) if (!*buf_size && next == END_NOT_FOUND)
next = 0; next = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment