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 C1E7F48474 for ; Tue, 5 Dec 2023 09:41:38 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8553368CEE8; Tue, 5 Dec 2023 11:41:35 +0200 (EET) Received: from s.wfbtzhsw.outbound-mail.sendgrid.net (s.wfbtzhsw.outbound-mail.sendgrid.net [159.183.224.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CDEA568CB92 for ; Tue, 5 Dec 2023 11:41:29 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=frankplowman.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: content-transfer-encoding:cc:content-type:from:subject:to; s=s1; bh=Oi7C5a7LjpH3hqgb7kkNrhg7cm4qIUO+hrVgWT2IugE=; b=eDAYZ4R9/fNacmqFHr1hDRzsGkEblVVXiYj+/arqlPpd+0QvzPhsyI2dv/p2klqee0+r SovVRDHQDCEOO0TiddDnE10ukBW70sgVe6Se86GlarUn/NYrsAu3uUEgDcsGg0VRSBbND+ AP1aiuH2dMwPOEHe2ZpzBeJydfN6VGL8EgR00tUkRNQBz/9j/TDwdmMGcBA2/LdBF2N5bc pqhP7SViKVdKMGrMvdOIMe+IOrqMUmc2AwZiOFMYMXs8xhfoIYQ8jhr1nwMfKbTrUNnO+1 d6zjMX1H6eCQHyx3xgiYjrpZszgYZXNen07E/QPJMs9Zt9333qP28rLJdaQtqQSw== Received: by filterdrecv-5bbdbb56cd-nws6q with SMTP id filterdrecv-5bbdbb56cd-nws6q-1-656EF023-2B 2023-12-05 09:40:51.959717999 +0000 UTC m=+4201259.243563008 Received: from localhost.localdomain (unknown) by geopod-ismtpd-4 (SG) with ESMTP id IDpwoelVTRqS0qIrD4KDDw Tue, 05 Dec 2023 09:40:51.675 +0000 (UTC) From: post@frankplowman.com Date: Tue, 05 Dec 2023 09:40:52 +0000 (UTC) Message-ID: <20231205094038.12293-1-post@frankplowman.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231203181259.63298-1-post@frankplowman.com> References: <20231203181259.63298-1-post@frankplowman.com> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?c4f4aE1Y0RBySa=2FirqQxUJWZDkoLQ0t=2FfkUe34xOGiGwhF5a5rjyuwmPWBxd26?= =?us-ascii?Q?lDOCFCHMlWKlYQxGAdT1lZObEcSr06Hr5b9vmeP?= =?us-ascii?Q?SJuYgG1yHl1MqBalP0N29ZuMfrI9Ur+4MlzCU0B?= =?us-ascii?Q?OJgwRqJOD1UeEI392RUKfM+DO0DakYVWD4Uqlr6?= =?us-ascii?Q?3Y4NRZZ6KzuDlnmX7txqj0np9z9+XCXruU9ZsT6?= =?us-ascii?Q?MwdaH855bAblyAs90=3D?= To: ffmpeg-devel@ffmpeg.org X-Entity-ID: LpPALsXh5JN/Quf2dstifQ== Subject: [FFmpeg-devel] [PATCH v2] libavformat/vvc: Make probe more conservative 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 Cc: Frank Plowman Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Frank Plowman Reduce false positives for VVC files by adding additional checks in `vvc_probe`. Specifically, `nuh_temporal_id_plus1` is tested for valid values in extra cases depending on the NAL unit type, as per ITU-T H.266 section 7.4.2.2. Resolves trac=A0#10703. Signed-off-by: Frank Plowman --- libavformat/vvcdec.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/libavformat/vvcdec.c b/libavformat/vvcdec.c index 31c5ae1f14..0a0e24b71c 100644 --- a/libavformat/vvcdec.c +++ b/libavformat/vvcdec.c @@ -24,6 +24,22 @@ #include "avformat.h" #include "rawdec.h" = +static int check_temporal_id(uint8_t nuh_temporal_id_plus1, int type) +{ + if (nuh_temporal_id_plus1 =3D=3D 0) + return 0; + + if (nuh_temporal_id_plus1 !=3D 1) { + if (type >=3D VVC_IDR_W_RADL && type <=3D VVC_RSV_IRAP_11 + || type =3D=3D VVC_DCI_NUT || type =3D=3D VVC_OPI_NUT + || type =3D=3D VVC_VPS_NUT || type =3D=3D VVC_SPS_NUT + || type =3D=3D VVC_EOS_NUT || type =3D=3D VVC_EOB_NUT) + return 0; + } + + return 1; +} + static int vvc_probe(const AVProbeData *p) { uint32_t code =3D -1; @@ -39,7 +55,7 @@ static int vvc_probe(const AVProbeData *p) if (code & 0x80) // forbidden_zero_bit return 0; = - if ((nal2 & 0x7) =3D=3D 0) // nuh_temporal_id_plus1 + if (!check_temporal_id(nal2 & 0x7, type)) return 0; = switch (type) { -- = 2.43.0 _______________________________________________ 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".