From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id AD0CA4B82D for ; Sun, 16 Jun 2024 07:48:52 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 64B2C68D6A6; Sun, 16 Jun 2024 10:48:41 +0300 (EEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1092E68D5D6 for ; Sun, 16 Jun 2024 10:48:34 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 418EC1BF205 for ; Sun, 16 Jun 2024 07:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1718524113; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8jMK0gj+sgHKdgZSBWsg7yGe/wM8sqJGARY4cUTHgAM=; b=T3NQs8U/b4b5w0MsIkCouP6EH29xLA9D2yxjLqfFnLCAtGf+5X8783nwdezqARFDJH/DqM wL30qs5XuFBcdIakHAibY/99AwbMs1rO8zXxc8RKtDuKoU4ac00hG2C9q9Vk2qhm5H1zoA ro9KD91I7ZRLvUDgfIcRtYTIxR19J17YKfa/rFeZn7NVuAmRapI2h+vg/P5CfuH3LRzgRU WD8ZByCt9ijdr1cHXvnlhycJXGOACtr0vkaTgMA6fBbct+IwKzwYW9MrnXL0h/IWmZjG4b MDWmrBR/OlPoGyl1EA4+HhWuRw1HSLHfYXIImVjOcRvcC4BnmfY+Snr1dUR1rw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 16 Jun 2024 09:48:31 +0200 Message-ID: <20240616074831.339149-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240616074831.339149-1-michael@niedermayer.cc> References: <20240616074831.339149-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/2] swscale/output: Avoid undefined overflow in yuv2rgb_write_full() 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: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Fixes: signed integer overflow: -140140 * 16525 cannot be represented in type 'int' Fixes: 68859/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-4516387130245120 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libswscale/output.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libswscale/output.c b/libswscale/output.c index f9ce43dde80..0e6181b3e01 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -1925,9 +1925,9 @@ static av_always_inline void yuv2rgb_write_full(SwsContext *c, Y -= c->yuv2rgb_y_offset; Y *= c->yuv2rgb_y_coeff; Y += 1 << 21; - R = (unsigned)Y + V*c->yuv2rgb_v2r_coeff; - G = (unsigned)Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff; - B = (unsigned)Y + U*c->yuv2rgb_u2b_coeff; + R = (unsigned)Y + V*(unsigned)c->yuv2rgb_v2r_coeff; + G = (unsigned)Y + V*(unsigned)c->yuv2rgb_v2g_coeff + U*(unsigned)c->yuv2rgb_u2g_coeff; + B = (unsigned)Y + U*(unsigned)c->yuv2rgb_u2b_coeff; if ((R | G | B) & 0xC0000000) { R = av_clip_uintp2(R, 30); G = av_clip_uintp2(G, 30); -- 2.45.2 _______________________________________________ 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".