aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-03-10 23:45:19 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-03-24 10:38:52 +0100
commit5e09dc8afebbdefa0b4c1b3d9e6b5b601e2b815b (patch)
tree34bd645915f85ed4baabec8ecd7a69dd685ee27a
parent51d29541cb22b2fb258fcafbd8bf6038c35a3a62 (diff)
downloadffmpeg-5e09dc8afebbdefa0b4c1b3d9e6b5b601e2b815b.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.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c
index fdc1e198da..5aa1c8408e 100644
--- a/libavcodec/dfa.c
+++ b/libavcodec/dfa.c
@@ -353,6 +353,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);