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 ESMTPS id 842B64B241 for ; Tue, 21 Jan 2025 18:02:18 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1CF2868B74D; Tue, 21 Jan 2025 20:02:15 +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 1408468B3FC for ; Tue, 21 Jan 2025 20:02:08 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id 62F1A40006 for ; Tue, 21 Jan 2025 18:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1737482527; 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=iLEh7/Sty5f3VY2ZFloUnR0haKK/8ZrA2tCxZZTW8fo=; b=fhd96j/6Ksn0V+c+jgEhJazB6z9mIrWFYphH71J5xvvZobNSemRUx2l4mN5kHkmGnMpXB/ /OBzkVFEodRn6/DRhgLzxwvXWT/eMxnfYP5b8jfzBhIa9wm6eO4DySZjpE9HPiGSaZAWKo F9T4+RfZLccJzPXSMVnh+D3c/hIFpUyYQpeBI9SnLnaDeCt+qzeW1Ib5omAmpLkgOoEn8C wcS1/79OxMZ4Y87mPtuxfS1dYRFEHyXAxPQFIy07bUoBzrNb+gwASpZC+GwJ9XA80hI9CL b6RDiXWzIHLENdedhaxzCnABKp6fKkrlwIdAAteS5h502Ja4bUDtEg6HVUeSSQ== Date: Tue, 21 Jan 2025 19:02:06 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20250121180206.GN4991@pb2> References: <20250101051505.1660885-1-michael@niedermayer.cc> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH v2] avformat/vqf: Propagate errors from add_metadata() 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="===============2936260924306831147==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============2936260924306831147== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ORLlwwdd8T2X/Gd2" Content-Disposition: inline --ORLlwwdd8T2X/Gd2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 01, 2025 at 07:53:27PM +0100, Alexander Strasser via ffmpeg-dev= el wrote: > On 2025-01-01 06:15 +0100, Michael Niedermayer wrote: > > Suggested-by: Marton Balint > > Signed-off-by: Michael Niedermayer > > --- > > libavformat/vqf.c | 21 ++++++++++++++------- > > 1 file changed, 14 insertions(+), 7 deletions(-) > > > > diff --git a/libavformat/vqf.c b/libavformat/vqf.c > > index 79deb33744b..58b1546f531 100644 > > --- a/libavformat/vqf.c > > +++ b/libavformat/vqf.c > > @@ -51,23 +51,28 @@ static int vqf_probe(const AVProbeData *probe_packe= t) > > return AVPROBE_SCORE_EXTENSION; > > } > > > > -static void add_metadata(AVFormatContext *s, uint32_t tag, > > +static int add_metadata(AVFormatContext *s, uint32_t tag, > > unsigned int tag_len, unsigned int remaining) > > { > > int len =3D FFMIN(tag_len, remaining); > > char *buf, key[5] =3D {0}; > > + int ret; > > > > if (len =3D=3D UINT_MAX) > > - return; > > + return AVERROR_INVALIDDATA; > > > > buf =3D av_malloc(len+1); > > if (!buf) > > - return; > > - if (len !=3D avio_read(s->pb, buf, len)) > > - return; > > + return AVERROR(ENOMEM); > > + > > + ret =3D avio_read(s->pb, buf, len); > > + if (ret < 0) > > + return ret; > > + if (len !=3D ret) > > + return AVERROR_INVALIDDATA; > > buf[len] =3D 0; > > AV_WL32(key, tag); > > - av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL); > > + return av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL= ); > > } > > > > static const AVMetadataConv vqf_metadata_conv[] =3D { > > @@ -165,7 +170,9 @@ static int vqf_read_header(AVFormatContext *s) > > avio_skip(s->pb, FFMIN(len, header_size)); > > break; > > default: > > - add_metadata(s, chunk_tag, len, header_size); > > + ret =3D add_metadata(s, chunk_tag, len, header_size); > > + if (ret < 0) > > + return ret; > > break; > > } > > > > -- >=20 > LGTM regarding my review comments. will apply thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB There will always be a question for which you do not know the correct answe= r. --ORLlwwdd8T2X/Gd2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ4/hGgAKCRBhHseHBAsP q6dcAKCBkcO/Iy3d2RJQQZ/4xQcd9SruigCfXOgbLYo5aDQVWowiqtFJcBmxvco= =9tLC -----END PGP SIGNATURE----- --ORLlwwdd8T2X/Gd2-- --===============2936260924306831147== 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". --===============2936260924306831147==--