Fixes: OOM Fixes: 14198/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5723579234123776
Unified · Split
| @@ -1049,6 +1049,9 @@ static int decode_huffman2(AVCodecContext *avctx, int header, int size) · 1048 unmodified lines | ||
| 1049 | 1049 | |
| 1050 | 1050 | s->output_size = get_bits_long(gb, 32); |
| 1051 | 1051 | |
| 1052 | + if (s->output_size > avctx->width * avctx->height * 9LL + 10000) | |
| 1053 | + return AVERROR_INVALIDDATA; | |
| 1054 | + | |
| 1052 | 1055 | av_fast_padded_malloc(&s->output, &s->padded_output_size, s->output_size); |
| 1053 | 1056 | if (!s->output) |
| 1054 | 1057 | return AVERROR(ENOMEM); |