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 511BF44C68 for ; Fri, 13 Jan 2023 20:49:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6C1B868BC69; Fri, 13 Jan 2023 22:49:43 +0200 (EET) Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BCD9F68B1FD for ; Fri, 13 Jan 2023 22:49:36 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 6792B40006 for ; Fri, 13 Jan 2023 20:49:35 +0000 (UTC) Date: Fri, 13 Jan 2023 21:49:32 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230113204932.GO1949656@pb2> References: <20230113000138.9994-1-michael@niedermayer.cc> <20230113000138.9994-2-michael@niedermayer.cc> <8b9a4802-58fe-3009-2002-b3b6cddc4d19@gmail.com> MIME-Version: 1.0 In-Reply-To: <8b9a4802-58fe-3009-2002-b3b6cddc4d19@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="===============0364978877257692873==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============0364978877257692873== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LwbuP8dfxhLLLUfV" Content-Disposition: inline --LwbuP8dfxhLLLUfV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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_fuzz= er-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 *avctx, = 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. what is the advantage of this ? thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle --LwbuP8dfxhLLLUfV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCY8HD1gAKCRBhHseHBAsP q6DaAJ47Jl8i2jcrDuFjJkgW+Jyrp89uCwCgiQmQrbB6baok/UDmXRZ1jYZdJQo= =w2RD -----END PGP SIGNATURE----- --LwbuP8dfxhLLLUfV-- --===============0364978877257692873== 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". --===============0364978877257692873==--