aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-25 01:07:34 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:49:26 +0200
commited0ffdf09d767004b797214281c5a1a755f60cbe (patch)
treef9a084458ccdf673dd4364a63d907821b112f956
parent71e047e45ce69f46c33ad26e86d25954473d602a (diff)
downloadffmpeg-ed0ffdf09d767004b797214281c5a1a755f60cbe.tar.gz
avcodec/g729_parser: Check block_size
Fixes: Infinite loop Fixes: 17611/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ACELP_KELVIN_fuzzer-5765134928052224 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 972a0a818ff7a9b33c7f37e08783f4b6082f9aa2) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/g729_parser.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/g729_parser.c b/libavcodec/g729_parser.c
index d13c990807..a2cecb7223 100644
--- a/libavcodec/g729_parser.c
+++ b/libavcodec/g729_parser.c
@@ -51,6 +51,12 @@ static int g729_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
s->duration = avctx->frame_size;
}
+ if (!s->block_size) {
+ *poutbuf = buf;
+ *poutbuf_size = buf_size;
+ return buf_size;
+ }
+
if (!s->remaining)
s->remaining = s->block_size;
if (s->remaining <= buf_size) {