From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 5E1114C0DB for ; Tue, 29 Jul 2025 21:01:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id CD07668C154; Wed, 30 Jul 2025 00:01:45 +0300 (EEST) Received: from sender-op-o11.zoho.eu (sender-op-o11.zoho.eu [136.143.169.11]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id C7A1968BBFB for ; Wed, 30 Jul 2025 00:01:38 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; t=1753822896; cv=none; d=zohomail.eu; s=zohoarc; b=UiTfJsKa6SIjVVs+M5Hl5EgcTB3kdPQY/e4z0e0aOe7JcG1sLhRrNJm1YhRnrCNHzKD7DYTEEW7DyjtzNWtTbc4hYDX/nttRKXX1XDeAQ2wGPKk4cCN3BrA5whtBOJeYUTxVBw9eZ6VQZY1JBJgwU/INgEsWma0msMhnTdB/qHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1753822896; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=RaxpWCOKBKFSayZEBFYZ+18w3pUuOuALXq8rjE/jBms=; b=PILxvaDCq9tXHDa6x4cheUHZI66SfqV9nYFBbu9T0S+kSAoPUumQ91c5b8W9cZCvgHw6ENbvmtrB5pKAlsKaG0EJwBdITOcqEp+ToqKH3OvvbXfZBmYXi26/KCb8uAMSkq5qYL7K8GvgEasUq7hpDNFWR7/wUqjqkmc71ZVyUgU= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=frankplowman.com; spf=pass smtp.mailfrom=post@frankplowman.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1753822896; s=zmail; d=frankplowman.com; i=post@frankplowman.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=RaxpWCOKBKFSayZEBFYZ+18w3pUuOuALXq8rjE/jBms=; b=ZA+6CwgFN/D5euRI95CpJGIaVjDFXVE9vMSfDFIlBKAomQvEZVEA00Bh92DybR+n +0nq7zvHjCjmAR6pP7parZSY0vcnjFGNKRtCclaUm3MEvMr6SzK/oWyTqzuY3qYgCbz IjeZD9bi887mgCgF0//HGr0CBCH3EIlszhjmVl3Y= Received: by mx.zoho.eu with SMTPS id 1753822893478471.97332173122857; Tue, 29 Jul 2025 23:01:33 +0200 (CEST) From: Frank Plowman To: ffmpeg-devel@ffmpeg.org Date: Tue, 29 Jul 2025 22:00:57 +0100 Message-ID: <20250729210130.64663-1-post@frankplowman.com> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-ZohoMailClient: External Subject: [FFmpeg-devel] [PATCH] lavc/vvc: Mark SPS used if multiple CLVSSs use it 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 , nuomi2021@gmail.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Consider the following sequence of NALUs (with some PPSs etc. omitted for brevity): 1. SPS (ID=0, content=A) 2. IDR (SPS=0) 3. IDR (SPS=0) 4. SPS (ID=0, content=B) 5. TRAIL (SPS=0) When decode_sps is called for NALU 3., ps->sps_id_used is cleared as IDRs are one way of forming a CLVSS. Then, old_sps is non-NULL containing the result of calling decode_sps for NALU 2. We haven't received any SPSs between NALUs 2. and 3., therefore old_sps and rsps are identical and the function returns. The issue is that, at this point, ps->sps_id_used is still zero despite the SPS being used for IDR 3. This results in the check for conflicting SPSs not working properly when decode_sps is called for NALU 5., allowing prediction between pictures with different SPSs and probably all sorts of other shenanigans. Patch addresses the problem outlined above by also setting ps->sps_id_used in the early return case. Signed-off-by: Frank Plowman --- Patch is also available at https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20061 --- libavcodec/vvc/ps.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/vvc/ps.c b/libavcodec/vvc/ps.c index d9f46b219a..6eec0fe586 100644 --- a/libavcodec/vvc/ps.c +++ b/libavcodec/vvc/ps.c @@ -288,9 +288,10 @@ static int decode_sps(VVCParamSets *ps, AVCodecContext *c, const H266RawSPS *rsp } if (old_sps) { - if (old_sps->r == rsps || !memcmp(old_sps->r, rsps, sizeof(*old_sps->r))) + if (old_sps->r == rsps || !memcmp(old_sps->r, rsps, sizeof(*old_sps->r))) { + ps->sps_id_used |= (1 << sps_id); return 0; - else if (ps->sps_id_used & (1 << sps_id)) + } else if (ps->sps_id_used & (1 << sps_id)) return AVERROR_INVALIDDATA; } -- 2.47.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".