aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-07-06 09:21:52 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-11-14 23:30:38 +0100
commit5bcced7beaedaa89996e7c73cb92dbc63b9341f3 (patch)
treebfde929e9a64359b909928460159a992ecc81e19
parentc2507e1946d345ca6e8cb63624c8509f7b63bd31 (diff)
downloadffmpeg-5bcced7beaedaa89996e7c73cb92dbc63b9341f3.tar.gz
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/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 15008db0fac6d97bb939fa7ef9e92d79bf1f7cb1) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/parser.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 670680ea7c..1b50f40b20 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -262,6 +262,9 @@ int ff_combine_frame(ParseContext *pc, int next,
for (; pc->overread > 0; pc->overread--)
pc->buffer[pc->index++] = pc->buffer[pc->overread_index++];
+ if (next > *buf_size)
+ return AVERROR(EINVAL);
+
/* flush remaining if EOF */
if (!*buf_size && next == END_NOT_FOUND)
next = 0;