Fixes: Timeout (11sec -> 3sec)
Fixes: 13218/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DFA_fuzzer-5661074316066816
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 f20760fadbc77483b9ff4b400b53ebb38ee33793)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
... | ... |
@@ -355,6 +355,8 @@ static int dfa_decode_frame(AVCodecContext *avctx, |
355 | 355 |
|
356 | 356 |
bytestream2_init(&gb, avpkt->data, avpkt->size); |
357 | 357 |
while (bytestream2_get_bytes_left(&gb) > 0) { |
358 |
+ if (bytestream2_get_bytes_left(&gb) < 12) |
|
359 |
+ return AVERROR_INVALIDDATA; |
|
358 | 360 |
bytestream2_skip(&gb, 4); |
359 | 361 |
chunk_size = bytestream2_get_le32(&gb); |
360 | 362 |
chunk_type = bytestream2_get_le32(&gb); |