Browse Source

avcodec/dfa: Check the chunk header is not truncated

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 f20760fadb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n2.8.16
Michael Niedermayer 7 years ago
parent
commit
ce5fb015ac
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      libavcodec/dfa.c

+ 2
- 0
libavcodec/dfa.c View File

@@ -353,6 +353,8 @@ static int dfa_decode_frame(AVCodecContext *avctx,


bytestream2_init(&gb, avpkt->data, avpkt->size); bytestream2_init(&gb, avpkt->data, avpkt->size);
while (bytestream2_get_bytes_left(&gb) > 0) { while (bytestream2_get_bytes_left(&gb) > 0) {
if (bytestream2_get_bytes_left(&gb) < 12)
return AVERROR_INVALIDDATA;
bytestream2_skip(&gb, 4); bytestream2_skip(&gb, 4);
chunk_size = bytestream2_get_le32(&gb); chunk_size = bytestream2_get_le32(&gb);
chunk_type = bytestream2_get_le32(&gb); chunk_type = bytestream2_get_le32(&gb);


Loading…
Cancel
Save