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 EC78944DFB for ; Mon, 26 Dec 2022 21:50:53 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2D3BD68BBCC; Mon, 26 Dec 2022 23:50:51 +0200 (EET) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 43DB368B635 for ; Mon, 26 Dec 2022 23:50:44 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 6876760003 for ; Mon, 26 Dec 2022 21:50:43 +0000 (UTC) Date: Mon, 26 Dec 2022 22:50:42 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20221226215042.GO3806951@pb2> References: <20221225220323.20968-1-michael@niedermayer.cc> MIME-Version: 1.0 In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 1/2] avcodec/hdrdec: Check for end of input in decompress() 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="===============6657080890974869931==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============6657080890974869931== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="glG7QM0/F4Gfd30i" Content-Disposition: inline --glG7QM0/F4Gfd30i Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 26, 2022 at 03:08:38PM +0100, Paul B Mahol wrote: > On 12/25/22, Michael Niedermayer wrote: > > Fixes: Timeout > > Fixes: > > 54386/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HDR_fuzzer-5053= 598268784640 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/hdrdec.c | 14 +++++++++++--- > > 1 file changed, 11 insertions(+), 3 deletions(-) > > > > diff --git a/libavcodec/hdrdec.c b/libavcodec/hdrdec.c > > index 21d3e7f693..998227744b 100644 > > --- a/libavcodec/hdrdec.c > > +++ b/libavcodec/hdrdec.c > > @@ -58,6 +58,8 @@ static int decompress(uint8_t *scanline, int w, > > GetByteContext *gb, const uint8_ > > int rshift =3D 0; > > > > while (w > 0) { > > + if (bytestream2_get_bytes_left(gb) < 4) > > + return AVERROR_INVALIDDATA; > > scanline[0] =3D bytestream2_get_byte(gb); > > scanline[1] =3D bytestream2_get_byte(gb); > > scanline[2] =3D bytestream2_get_byte(gb); > > @@ -143,13 +145,17 @@ static int hdr_decode_frame(AVCodecContext *avctx, > > AVFrame *p, > > int i; > > > > if (width < MINELEN || width > MAXELEN) { > > - decompress(scanline, width, &gb, scanline); > > + ret =3D decompress(scanline, width, &gb, scanline); > > + if (ret < 0) > > + return ret; > > goto convert; > > } > > > > i =3D bytestream2_peek_byte(&gb); > > if (i !=3D 2) { > > - decompress(scanline, width, &gb, scanline); > > + ret =3D decompress(scanline, width, &gb, scanline); > > + if (ret < 0) > > + return ret; > > goto convert; > > } > > bytestream2_skip(&gb, 1); > > @@ -161,7 +167,9 @@ static int hdr_decode_frame(AVCodecContext *avctx, > > AVFrame *p, > > if (scanline[1] !=3D 2 || scanline[2] & 128) { > > scanline[0] =3D 2; > > scanline[3] =3D i; > > - decompress(scanline + 4, width - 1, &gb, scanline); > > + ret =3D decompress(scanline + 4, width - 1, &gb, scanline); > > + if (ret < 0) > > + return ret; > > goto convert; > > } > > > > -- > > 2.17.1 > > >=20 > LGTM will apply thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato --glG7QM0/F4Gfd30i Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCY6oXMgAKCRBhHseHBAsP qygoAJ4tg2WsFjSBvC26omWJFIz+llz3IgCfeU/+aBKoRGILrKSkzL+Ji8uIhD8= =/Lp6 -----END PGP SIGNATURE----- --glG7QM0/F4Gfd30i-- --===============6657080890974869931== 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". --===============6657080890974869931==--