diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-04-24 18:41:13 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-04-30 22:25:01 +0300 |
commit | 19af948e53fb8a8d26eb57785420feffd91b619d (patch) | |
tree | 86ca92a67902abd36e80df0de93b726bc8f09198 /libavcodec/agm.c | |
parent | f4a1b8d409639b2394589efe20ad55410cce391c (diff) |
avcodec/agm: Check output size before allocation
Fixes: OOM
Fixes: 14198/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5723579234123776
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/agm.c')
-rw-r--r-- | libavcodec/agm.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/agm.c b/libavcodec/agm.c index 332e33897c..a499c09082 100644 --- a/libavcodec/agm.c +++ b/libavcodec/agm.c @@ -1049,6 +1049,9 @@ static int decode_huffman2(AVCodecContext *avctx, int header, int size) s->output_size = get_bits_long(gb, 32); + if (s->output_size > avctx->width * avctx->height * 9LL + 10000) + return AVERROR_INVALIDDATA; + av_fast_padded_malloc(&s->output, &s->padded_output_size, s->output_size); if (!s->output) return AVERROR(ENOMEM); |