[FFmpeg-cvslog] avcodec/smacker: Check space before decoding type
Michael Niedermayer
git at videolan.org
Fri Jan 31 01:13:55 EET 2020
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Jan 1 20:43:05 2020 +0100| [6f5c18da5977a3214e1ea30e6b0c0d9d858ce83d] | committer: Michael Niedermayer
avcodec/smacker: Check space before decoding type
Fixes: Timeout (232sec -> 280ms)
Fixes: 19682/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKER_fuzzer-5654129649385472
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6f5c18da5977a3214e1ea30e6b0c0d9d858ce83d
---
libavcodec/smacker.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 4c20831155..b4c463b4b9 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -398,6 +398,8 @@ static av_always_inline int smk_get_code(GetBitContext *gb, int *recode, int *la
int v;
while(*table & SMK_NODE) {
+ if (get_bits_left(gb) < 1)
+ return AVERROR_INVALIDDATA;
if(get_bits1(gb))
table += (*table) & (~SMK_NODE);
table++;
@@ -462,6 +464,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
uint16_t pix;
type = smk_get_code(&gb, smk->type_tbl, smk->type_last);
+ if (type < 0)
+ return type;
run = block_runs[(type >> 2) & 0x3F];
switch(type & 3){
case SMK_BLK_MONO:
More information about the ffmpeg-cvslog
mailing list