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 0564D4BC60 for ; Sat, 28 Jun 2025 00:22:09 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id C363368E218; Sat, 28 Jun 2025 03:22:05 +0300 (EEST) Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 6612568E1F2 for ; Sat, 28 Jun 2025 03:21:59 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id BF1D541B5F for ; Sat, 28 Jun 2025 00:21:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1751070118; 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; bh=WyTbl4DZ4N24ZmqBzCKgT4a1rp0wbUkNCSqPF7pr4Ro=; b=HKwEiH0NuxQLxkQgBuPv5n/2tGXn41BJN2hXWZDiT2jBmY0khh2yy/o4BdP0o0NQrgZzek xU3gS4LRgLuDi1vJZRoEGrBXd7ADWRMY2t5+UATH/qK7sV6jSmb6ZSWZz3Kl2fTqqKkgit O7uNKZtboaHvmAhSC+pxj02gts59OHhrYutd6VwQB4S/nwocDbyC+6wjElau/V66qAprHz nkfBaFoBQPhpgGMuQl3jYojfbqMdmOquGgkgTcR7eXNq9S68yaco4v2VbEfaWkYIfMkfyz wURH/CQvCcITO9I9bvdVAP+XA6Gu/Qo2tCsH0Bk5/W+p3boS9H+9pikrIM7qgQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 28 Jun 2025 02:21:57 +0200 Message-ID: <20250628002157.3665951-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-GND-State: clean X-GND-Score: -70 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdeggeelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdeftddmnecujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpefhledvvdehgfettdefueevtdeifffhkeeljeetjeeugfelgfffieduheevvefgvdenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH] avcodec/rv60dec: Check ofs for overflows 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: 30 + 2147483647 cannot be represented in type 'int' Fixes: 418335931/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV60_fuzzer-6568264620900352 Signed-off-by: Michael Niedermayer --- libavcodec/rv60dec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/rv60dec.c b/libavcodec/rv60dec.c index 6075598861d..4a3d9067db6 100644 --- a/libavcodec/rv60dec.c +++ b/libavcodec/rv60dec.c @@ -2347,10 +2347,12 @@ static int rv60_decode_frame(AVCodecContext *avctx, AVFrame * frame, ofs = get_bits_count(&gb) / 8; for (int i = 0; i < s->cu_height; i++) { - if (header_size + ofs >= avpkt->size) + if (ofs >= avpkt->size - header_size) return AVERROR_INVALIDDATA; s->slice[i].data = avpkt->data + header_size + ofs; s->slice[i].data_size = FFMIN(s->slice[i].size, avpkt->size - header_size - ofs); + if (s->slice[i].size > INT32_MAX - ofs) + return AVERROR_INVALIDDATA; ofs += s->slice[i].size; } -- 2.49.0 _______________________________________________ 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".