diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2025-07-15 22:19:24 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2025-07-20 01:05:23 +0200 |
commit | 2d72bf6fe0793c3f069ba181a0e733dcc9f28180 (patch) | |
tree | 2fba94de52523e94b6dcb47a3920207be0202fb8 | |
parent | f7a6965308ab5a6e35a54570d9c7395d2569637c (diff) | |
download | ffmpeg-2d72bf6fe0793c3f069ba181a0e733dcc9f28180.tar.gz |
avcodec/cfhd: Check idwt_buf size before allocation
Fixes: OOM
Fixes: 428760799/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_DEC_fuzzer-5685176435015680
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/cfhd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 2044254c84..f110b91f0b 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -25,6 +25,7 @@ #include "libavutil/attributes.h" #include "libavutil/common.h" +#include "libavutil/imgutils.h" #include "libavutil/intreadwrite.h" #include "libavutil/mem.h" #include "libavutil/pixdesc.h" @@ -266,6 +267,9 @@ static int alloc_buffers(AVCodecContext *avctx) int height = (i || bayer) ? s->coded_height >> chroma_y_shift : s->coded_height; ptrdiff_t stride = (FFALIGN(width / 8, 8) + 64) * 8; + if ((ret = av_image_check_size2(stride, height, avctx->max_pixels, s->coded_format, 0, avctx)) < 0) + return ret; + if (chroma_y_shift && !bayer) height = FFALIGN(height / 8, 2) * 8; s->plane[i].width = width; |