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 A943D44C80 for ; Fri, 13 Jan 2023 20:56:44 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 16DDA68BC8C; Fri, 13 Jan 2023 22:56:43 +0200 (EET) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4419168B35D for ; Fri, 13 Jan 2023 22:56:36 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 64F70E0007 for ; Fri, 13 Jan 2023 20:56:35 +0000 (UTC) Date: Fri, 13 Jan 2023 21:56:34 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230113205634.GP1949656@pb2> References: <20230113000138.9994-1-michael@niedermayer.cc> <20230113000138.9994-2-michael@niedermayer.cc> <8b9a4802-58fe-3009-2002-b3b6cddc4d19@gmail.com> <20230113204932.GO1949656@pb2> <62497d11-56af-a19c-fe2d-b907f2c32898@gmail.com> MIME-Version: 1.0 In-Reply-To: <62497d11-56af-a19c-fe2d-b907f2c32898@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH 2/5] avcodec/xpmdec: Check size before allocation to avoid truncation 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="===============5752059835210460700==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============5752059835210460700== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="K8zN2sh9fO5jmbe4" Content-Disposition: inline --K8zN2sh9fO5jmbe4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 13, 2023 at 05:53:20PM -0300, James Almer wrote: > On 1/13/2023 5:49 PM, Michael Niedermayer wrote: > > On Thu, Jan 12, 2023 at 09:11:35PM -0300, James Almer wrote: > > >=20 > > >=20 > > > On 1/12/2023 9:01 PM, Michael Niedermayer wrote: > > > > Fixes:OOM > > > > Fixes:out of array access (no testcase) > > > > Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XPM_= fuzzer-6573323838685184 > > > >=20 > > > > Found-by: continuous fuzzing process https://github.com/google/oss-= fuzz/tree/master/projects/ffmpeg > > > > Signed-off-by: Michael Niedermayer > > > > --- > > > > libavcodec/xpmdec.c | 3 +++ > > > > 1 file changed, 3 insertions(+) > > > >=20 > > > > diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c > > > > index ff1f51dd32..504cc47d8f 100644 > > > > --- a/libavcodec/xpmdec.c > > > > +++ b/libavcodec/xpmdec.c > > > > @@ -356,6 +356,9 @@ static int xpm_decode_frame(AVCodecContext *avc= tx, AVFrame *p, > > > > size *=3D 4; > > > > + if (size > SIZE_MAX) > > > > + return AVERROR(ENOMEM); > > >=20 > > > Maybe check for (size > SIZE_MAX / 4) before the multiplication above > > > instead. > >=20 > > what is the advantage of this ? >=20 > An int64_t value will never be bigger than or equal to SIZE_MAX on 64 bits > targets, so maybe some compiler out there will warn about it. hmm ok, ill apply it with that change thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Does the universe only have a finite lifespan? No, its going to go on forever, its just that you wont like living in it. -- Hiranya Peiri --K8zN2sh9fO5jmbe4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCY8HFggAKCRBhHseHBAsP q9vUAJ4qHEmRNQyimzHtOwDebWo05HEFEgCfZa48YDYvTBlxpEbsb7+T6lFDyG4= =8qY6 -----END PGP SIGNATURE----- --K8zN2sh9fO5jmbe4-- --===============5752059835210460700== 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". --===============5752059835210460700==--