diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-03-10 23:45:19 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-03-21 10:42:52 +0100 |
commit | 2a2bc7918727eb2d1baa8e2eaffff7e279d0d9b1 (patch) | |
tree | 6f5198efe5a445d3e0febfb256c75856d5a0f529 | |
parent | 599cfce022b3d7f7b3641867254c7d8a2e027497 (diff) | |
download | ffmpeg-2a2bc7918727eb2d1baa8e2eaffff7e279d0d9b1.tar.gz |
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 f20760fadbc77483b9ff4b400b53ebb38ee33793)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/dfa.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index 970175fb73..c6106b9397 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -355,6 +355,8 @@ static int dfa_decode_frame(AVCodecContext *avctx, bytestream2_init(&gb, avpkt->data, avpkt->size); while (bytestream2_get_bytes_left(&gb) > 0) { + if (bytestream2_get_bytes_left(&gb) < 12) + return AVERROR_INVALIDDATA; bytestream2_skip(&gb, 4); chunk_size = bytestream2_get_le32(&gb); chunk_type = bytestream2_get_le32(&gb); |