diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2018-02-23 03:40:02 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-07-10 01:18:52 +0200 |
commit | 11d0464565d1cac24c57ad7c6822fc9db046a057 (patch) | |
tree | 9cb4b084325ffbd33b2c3b333486d7a4391084d9 | |
parent | d81e0f925a94a3d4f2a1c85447dc1d938e1e4fe5 (diff) | |
download | ffmpeg-11d0464565d1cac24c57ad7c6822fc9db046a057.tar.gz |
avcodec/smc: Check input packet size
Fixes: Timeout
Fixes: 6261/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMC_fuzzer-5811309653262336
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 0293663483ab5dbfff23602a62800d84e021b33c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/smc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/smc.c b/libavcodec/smc.c index 18174fa57e..66de691e2c 100644 --- a/libavcodec/smc.c +++ b/libavcodec/smc.c @@ -437,6 +437,10 @@ static int smc_decode_frame(AVCodecContext *avctx, SmcContext *s = avctx->priv_data; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); int ret; + int total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4); + + if (total_blocks / 1024 > avpkt->size) + return AVERROR_INVALIDDATA; bytestream2_init(&s->gb, buf, buf_size); |