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 361DB49B92 for ; Wed, 3 Apr 2024 09:59:16 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A399168D0C5; Wed, 3 Apr 2024 12:59:13 +0300 (EEST) Received: from sender-op-o19.zoho.eu (sender-op-e19.zoho.eu [136.143.169.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F10A368D0C5 for ; Wed, 3 Apr 2024 12:59:06 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; t=1712138341; cv=none; d=zohomail.eu; s=zohoarc; b=dUK32390FTXxpMsHELGqpU/klXCZBzvd1qQuYfDavBmI6gXZKLLtwzngEZ7wXBZ8ncojp5toAAWVggST2Ctr+3bk4dC184kyfPZF87Wxd4g5uozjcRYE9PrUwVrB1LlRltSUhgH+gBGCQnGKO9Cd1RmckT10FtDWs3K+Q4GwYts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1712138341; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=ZddDn5sFVU4pTgWgBi0WOA5QHLYoAsvfJqBXhTPa12A=; b=IenBNVNjfVIwWWk0zyiAmZcBDZAJeezagIWBMarQ4HVBUPYnC17ibj/nkSdLIFSiNZat2sVoSljWdSNUchHIjDAe5r5lkWaUA+TOcik7NJgPs7g0M42FV/CSt/ZXTVLPdRXRaQJPZJ4vo4yQ1mhU3tj/cr3KNoi7T7zr204xICk= 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=1712138341; s=zmail; d=frankplowman.com; i=post@frankplowman.com; h=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc; bh=ZddDn5sFVU4pTgWgBi0WOA5QHLYoAsvfJqBXhTPa12A=; b=US/B4XCoHelQhMgbIBH9nl/UPGReTf1R3wY+DfcpDQIOKSUHjKd9wb3MtmRh8kbA cqL/RXq93e1+R2lGweIKDMO9nTUJ6mAS94g7diyf4X0/Lh5ARSjMajyWuq1i4OCe9+1 gbtcvDYinNsroF/xzLg94PixjUsXiSNAuGCt+yfc= Received: from [10.0.0.4] (frankplowman.com [51.89.148.29]) by mx.zoho.eu with SMTPS id 1712138339497200.31827178979358; Wed, 3 Apr 2024 11:58:59 +0200 (CEST) Message-ID: <4a2478c3-ca80-4757-a28f-03f4e5e35b12@frankplowman.com> Date: Wed, 3 Apr 2024 10:58:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <20240402214843.474910-1-post@frankplowman.com> Content-Language: en-US From: Frank Plowman In-Reply-To: <20240402214843.474910-1-post@frankplowman.com> X-ZohoMailClient: External Subject: Re: [FFmpeg-devel] [PATCH] lavc/vvc: Only read split_cu_flag if a split is allowed 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 02/04/2024 22:48, Frank Plowman wrote: > Add a check to ensure some split is possible before reading the > split_cu_flag. This is present in the spec, in VVCv3 section 7.3.11.4. > Its omission could lead to infinite loops and ultimately crashing due to > stack overflow. > --- > libavcodec/vvc/vvc_ctu.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c > index 8ba12c8d9f..32d8bc8f5c 100644 > --- a/libavcodec/vvc/vvc_ctu.c > +++ b/libavcodec/vvc/vvc_ctu.c > @@ -2095,6 +2095,7 @@ static int hls_coding_tree(VVCLocalContext *lc, > const int ch_type = tree_type_curr == DUAL_TREE_CHROMA; > int ret; > VVCAllowedSplit allowed; > + int split_cu_flag; > > if (pps->r->pps_cu_qp_delta_enabled_flag && qg_on_y && cb_sub_div <= sh->cu_qp_delta_subdiv) { > lc->parse.is_cu_qp_delta_coded = 0; > @@ -2109,7 +2110,11 @@ static int hls_coding_tree(VVCLocalContext *lc, > > can_split(lc, x0, y0, cb_width, cb_height, mtt_depth, depth_offset, part_idx, > last_split_mode, tree_type_curr, mode_type_curr, &allowed); > - if (ff_vvc_split_cu_flag(lc, x0, y0, cb_width, cb_height, ch_type, &allowed)) { > + if (allowed.btv || allowed.bth || allowed.ttv || allowed.tth || allowed.qt) > + split_cu_flag = ff_vvc_split_cu_flag(lc, x0, y0, cb_width, cb_height, ch_type, &allowed); > + else > + split_cu_flag = 0; > + if (split_cu_flag) { > VVCSplitMode split = ff_vvc_split_mode(lc, x0, y0, cb_width, cb_height, cqt_depth, mtt_depth, ch_type, &allowed); > VVCModeType mode_type = mode_type_decode(lc, x0, y0, cb_width, cb_height, split, ch_type, mode_type_curr); > Retracting this patch as I missed that this logic is in fact implemented, just elsewhere. There is still a bug here, but it seems the condition to trigger it is more complex that I thought. Should have an alternative patch soon. _______________________________________________ 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".