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 AB8A64BFA3 for ; Sun, 22 Jun 2025 04:39:07 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 7F11068CD1D; Sun, 22 Jun 2025 07:39:03 +0300 (EEST) Received: from mx.sdf.org (mx.sdf.org [205.166.94.24]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 84E1E687CA4 for ; Sun, 22 Jun 2025 07:38:56 +0300 (EEST) Received: from d68bcc34515074c2bef9ef642706ab6e ([1.136.108.149]) (authenticated (0 bits)) by mx.sdf.org (8.18.1/8.14.3) with ESMTPSA id 55M4clL6015697 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO) for ; Sun, 22 Jun 2025 04:38:53 GMT Date: Sun, 22 Jun 2025 14:38:46 +1000 From: Peter Ross To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches References: <20250621211521.895204-1-michael@niedermayer.cc> <20250621211521.895204-3-michael@niedermayer.cc> MIME-Version: 1.0 In-Reply-To: <20250621211521.895204-3-michael@niedermayer.cc> Subject: Re: [FFmpeg-devel] [PATCH 3/5] avcodec/rv60dec: Check sum in read_slice_sizes() 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: multipart/mixed; boundary="===============2123019614828656663==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============2123019614828656663== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cD89FpZrEq9Wqoqq" Content-Disposition: inline --cD89FpZrEq9Wqoqq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 21, 2025 at 11:15:19PM +0200, Michael Niedermayer wrote: > Fixes: signed integer overflow: 2147483647 + 1913651185 cannot be represe= nted in type 'int' > Fixes: 418335931/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RV60_f= uzzer-6568264620900352 >=20 > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/t= ree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/rv60dec.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/libavcodec/rv60dec.c b/libavcodec/rv60dec.c > index 2bbcb1d6209..dbafa7eed02 100644 > --- a/libavcodec/rv60dec.c > +++ b/libavcodec/rv60dec.c > @@ -409,6 +409,8 @@ static int read_slice_sizes(RV60Context *s, GetBitCon= text *gb) > if (last_size <=3D 0) > return AVERROR_INVALIDDATA; > s->slice[i].size =3D last_size; > + if (s->slice[i].size > INT32_MAX - sum) > + return AVERROR_INVALIDDATA; > sum +=3D s->slice[i].size; As it turns out, sum is not used for any purpose. This patch (https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2025-June/34562= 1.html) drops sum, obviating the need for your patch. However later on in rv60dec.c, line ~2354, there is a similar summation of slice sizes. This might need a INT_MAX guard? for (int i =3D 0; i < s->cu_height; i++) { if (header_size + ofs >=3D avpkt->size) return AVERROR_INVALIDDATA; s->slice[i].data =3D avpkt->data + header_size + ofs; s->slice[i].data_size =3D FFMIN(s->slice[i].size, avpkt->size - h= eader_size - ofs); ofs +=3D s->slice[i].size; } -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B) --cD89FpZrEq9Wqoqq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQSpB+AvpuUM0jTNINJnYHnFrEDdawUCaFeI1gAKCRBnYHnFrEDd a/RjAJ9YEW9Og/Wr9G09Rsqcn0AWinypKgCgknfzihPZVfDOpSrWMEF03B81QFc= =15wc -----END PGP SIGNATURE----- --cD89FpZrEq9Wqoqq-- --===============2123019614828656663== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============2123019614828656663==--