From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id E9B154960E for ; Sun, 17 Aug 2025 13:40:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id DCB7768D363; Sun, 17 Aug 2025 16:39:56 +0300 (EEST) Received: from c1ad6a1ecdc3 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 27237687CC4 for ; Sun, 17 Aug 2025 16:39:55 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] =?utf-8?q?=5BPATCH=5D_avcodec/sanm=3A_Check_w=2Ch?= =?utf-8?b?LGxlZnQsdG9wIChQUiAjMjAyNjgp?= X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: michaelni via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: michaelni Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Message-Id: <20250817133956.DCB7768D363@ffbox0-bg.ffmpeg.org> Date: Sun, 17 Aug 2025 16:39:56 +0300 (EEST) Archived-At: List-Archive: List-Post: PR #20268 opened by michaelni URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20268 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20268.patch The setup code fow w,h,left,top is complex, the code using it also falls in at least 2 different classes, one using left/top the other not. To ensure no out of array access happens we add this clear check. Fixes: out of array access Fixes: 439261995/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SANM_fuzzer-5383455572819968 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer >From 134fbfd1dcb59441e38d870ddd231772f4e8e127 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 17 Aug 2025 15:31:48 +0200 Subject: [PATCH] avcodec/sanm: Check w,h,left,top The setup code fow w,h,left,top is complex, the code using it also falls in at least 2 different classes, one using left/top the other not. To ensure no out of array access happens we add this clear check. Fixes: out of array access Fixes: 439261995/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SANM_fuzzer-5383455572819968 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/sanm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index a066a864eb..9e99aa9dd9 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -1757,6 +1757,11 @@ static int process_frame_obj(SANMVideoContext *ctx, GetByteContext *gb) memset(ctx->fbuf, 0, ctx->frm0_size); } + if (w + FFMAX(left, 0) > ctx->avctx->width || h + FFMAX(top, 0) > ctx->avctx->height) { + avpriv_request_sample(ctx->avctx, "overly large frame\n"); + return AVERROR_PATCHWELCOME; + } + switch (codec) { case 1: case 3: -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".