diff mbox series

[FFmpeg-devel] avcodec/pixlet: consider minimum plane header in the minimal packet size

Message ID 20220501133758.27115-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel] avcodec/pixlet: consider minimum plane header in the minimal packet size | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer May 1, 2022, 1:37 p.m. UTC
Fixes: Timeout
Fixes: 46956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PIXLET_fuzzer-5698161106092032

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/pixlet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c
index 18a6587257..b16dd4aa87 100644
--- a/libavcodec/pixlet.c
+++ b/libavcodec/pixlet.c
@@ -611,7 +611,7 @@  static int pixlet_decode_frame(AVCodecContext *avctx, AVFrame *p,
     bytestream2_init(&ctx->gb, avpkt->data, avpkt->size);
 
     pktsize = bytestream2_get_be32(&ctx->gb);
-    if (pktsize <= 44 || pktsize - 4 > bytestream2_get_bytes_left(&ctx->gb)) {
+    if (pktsize <= 44 + (NB_LEVELS * 8 + 6) * 3 || pktsize - 4 > bytestream2_get_bytes_left(&ctx->gb)) {
         av_log(avctx, AV_LOG_ERROR, "Invalid packet size %"PRIu32"\n", pktsize);
         return AVERROR_INVALIDDATA;
     }