diff mbox series

[FFmpeg-devel,07/10] avcodec/sgirl edec: Check input length

Message ID 20240922215645.1182935-7-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,01/10] tools/target_dec_fuzzer: Add threshold for SRGC | 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 Sept. 22, 2024, 9:56 p.m. UTC
Fixes: Timeout
Fixes: 71712/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SGIRLE_fuzzer-5763700835811328

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/sgirledec.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Niedermayer Sept. 24, 2024, 1:26 p.m. UTC | #1
On Sun, Sep 22, 2024 at 11:56:42PM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 71712/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SGIRLE_fuzzer-5763700835811328
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/sgirledec.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

[...]
diff mbox series

Patch

diff --git a/libavcodec/sgirledec.c b/libavcodec/sgirledec.c
index 3ce72eccb86..3bd31b73470 100644
--- a/libavcodec/sgirledec.c
+++ b/libavcodec/sgirledec.c
@@ -115,6 +115,9 @@  static int sgirle_decode_frame(AVCodecContext *avctx, AVFrame *frame,
 {
     int ret;
 
+    if (avpkt->size * 192ll / 2 < avctx->width * avctx->height)
+        return AVERROR_INVALIDDATA;
+
     if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
         return ret;