summaryrefslogtreecommitdiff
path: root/libavcodec/g729_parser.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-25 01:07:34 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-09-26 21:02:34 +0200
commit972a0a818ff7a9b33c7f37e08783f4b6082f9aa2 (patch)
tree569a9c9da66f3dfe0b36b6398275ebc8d6c3b8a3 /libavcodec/g729_parser.c
parent02fb6a214717d40487cae2b06f13b14fabb6e101 (diff)
downloadffmpeg-972a0a818ff7a9b33c7f37e08783f4b6082f9aa2.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>
Diffstat (limited to 'libavcodec/g729_parser.c')
-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 5a57025d62..010f688104 100644
--- a/libavcodec/g729_parser.c
+++ b/libavcodec/g729_parser.c
@@ -53,6 +53,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) {