diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-07-28 21:09:14 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-08-04 21:16:28 +0200 |
commit | 6b04a5dd2d7f3ea81aeaee01bca4bdd1edcc22ac (patch) | |
tree | 1dfd7446f8e9d600e6a51f97c819ff44ec7e5357 | |
parent | 8d2e23508f20e0221418b9804fa9af4c90e73e3e (diff) | |
download | ffmpeg-6b04a5dd2d7f3ea81aeaee01bca4bdd1edcc22ac.tar.gz |
avcodec/eatgv: Check remaining size after the keyframe header
The minimal size which unpack() will not fail on is 5 bytes
Fixes: Timeout (14sec -> 77ms) (testcase 15508)
Fixes: 15508/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATGV_fuzzer-5700053513011200
Fixes: 15996/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EATGV_fuzzer-5751353223151616
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 009ec8dc3345353b1cd2316423918533fcb89552)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/eatgv.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c index 93e291f053..f82f7b9cca 100644 --- a/libavcodec/eatgv.c +++ b/libavcodec/eatgv.c @@ -300,6 +300,9 @@ static int tgv_decode_frame(AVCodecContext *avctx, s->palette[i] = 0xFFU << 24 | AV_RB24(buf); buf += 3; } + if (buf_end - buf < 5) { + return AVERROR_INVALIDDATA; + } } if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) |