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 2B86C4A602 for ; Thu, 2 May 2024 21:53:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9DAE368D888; Fri, 3 May 2024 00:53:27 +0300 (EEST) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 242D068D850 for ; Fri, 3 May 2024 00:53:21 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 7B20B240007 for ; Thu, 2 May 2024 21:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1714686800; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Rvbd3xMjnGXkreMIGXCp0Shj02GxhpvLK79TiADVgeY=; b=or62grke5EoAoGLp5uRE0ClDvv1xGdYoU74XD+5NaMaGryG2MBmpWN051j3bTTWYmU9zNE rgatCFUlUR6vQ0kHsZJ5Ppf9VciUNkkEZbL96BzLj1nRcCwiD1t/W3h4SxE+n91TdonZlX nwmHjvwhrQRdqKDsXaXmmDUlLnt85+A9oQp44P3HibRAT+BqVHaOnfSKgHtwe1A/R6ktwi 6lPZoe/UXA+lw1mSa0RE5gsIm5JCzPe0u/p7pQQauiFFztHdVI7V4plxU93589XEkyyk7y 8B+l9NgvzvBluTqsCt7qzYZLQXnslHAeybI5zQ2MMGDwu0T5/Rnl7wrlCPKA2A== Date: Thu, 2 May 2024 23:53:19 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240502215319.GH6420@pb2> References: <20240502004150.3627661-1-michael@niedermayer.cc> <20240502004150.3627661-5-michael@niedermayer.cc> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 5/7] avcodec/avs3_parser: Check the return value of init_get_bits8() 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="===============7607575302615713268==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============7607575302615713268== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fTKMNpWFF5ij3Ofz" Content-Disposition: inline --fTKMNpWFF5ij3Ofz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 02, 2024 at 10:28:36AM +0200, Andreas Rheinhardt wrote: > Michael Niedermayer: > > Fixes: CID1492867 Unchecked return value > >=20 > > Sponsored-by: Sovereign Tech Fund > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/avs3_parser.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > >=20 > > diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c > > index a819b5783d6..0f9076befe1 100644 > > --- a/libavcodec/avs3_parser.c > > +++ b/libavcodec/avs3_parser.c > > @@ -73,7 +73,9 @@ static void parse_avs3_nal_units(AVCodecParserContext= *s, const uint8_t *buf, > > GetBitContext gb; > > int profile, ratecode, low_delay; > > =20 > > - init_get_bits8(&gb, buf + 4, buf_size - 4); > > + int ret =3D init_get_bits8(&gb, buf + 4, buf_size - 4); > > + if (ret < 0) > > + return; > > =20 > > s->key_frame =3D 1; > > s->pict_type =3D AV_PICTURE_TYPE_I; >=20 > This code only reads/skips a few bits here (at most 100 if I counted > correctly), so one could initialize the reader for a shorter length and > assert that the call succeeds. will apply: - init_get_bits8(&gb, buf + 4, buf_size - 4); + av_unused int ret =3D init_get_bits(&gb, buf + 4, 100); + av_assert1(ret >=3D 0); thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle=20 --fTKMNpWFF5ij3Ofz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZjQLTAAKCRBhHseHBAsP q3baAKCNmeQZAm0MbwQoqC66VReM1IiOJQCeL5AQv9X+vkbobxFqiL8Y1VS1Fi4= =vM/j -----END PGP SIGNATURE----- --fTKMNpWFF5ij3Ofz-- --===============7607575302615713268== 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". --===============7607575302615713268==--