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 5910348556 for ; Mon, 5 Feb 2024 18:00:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1FFDE68CDE9; Mon, 5 Feb 2024 20:00:26 +0200 (EET) Received: from sender21-mail.zoho.eu (sender11-op-o12.zoho.eu [31.186.226.226]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DF39F68CA64 for ; Mon, 5 Feb 2024 20:00:19 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; t=1707156018; cv=none; d=zohomail.eu; s=zohoarc; b=T43ZAm+9e8Vu46zLh2e/zXGuhcymmuXh9zTYUernUIItVM2iOJV5/H1poe3nWcH+HWtEgaEhZYLkj0h0WDZCZjHg222+edDW7bGt9FTDxhDGP7lA+oTa3rMpPb7J7GWtwv1s49Pkzv1mNxMlOyO4zuZd0YDO3/L6hyDywilf8nQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1707156018; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=K9zA1bjJRNA2BOiwzFMxhmLTOx2kQtO07+snuVwTmF8=; b=Px85lFHpSyzf7haapVnEMOXsWFGC2Q7C5xygfxOXlFu/BD9a8ZFKPID9NpoeLFXo2fBiqhf+EIc2ocVwpNS2WbBjboc60D+diWhyc8mFUNqslxiClLGNQlR/0XUOYTAMu9Ag4uqNQZD8bKYoY7n1MKfzsHyy9wkLk4VAYwhrFh8= 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=1707156018; 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=K9zA1bjJRNA2BOiwzFMxhmLTOx2kQtO07+snuVwTmF8=; b=Z+2NFQ8YKUsmyx+975sngnYVaqz1MDFVHCZSKDGd5BugpbUmht2+9/KrTZC9YY1i hcwGsrD9vc8tCSJ5/FYyoie2MLDGH86bKq9hIr2ojrDxPJbL8rk9CAwkUNDQKJYgnXN G9v4hfqaYnRJnmnmoJ/yUAjvyj8AyccUdeeIaJ5c= Received: from localhost.localdomain (frankplowman.com [51.89.148.29]) by mx.zoho.eu with SMTPS id 1707156015586252.45122230904815; Mon, 5 Feb 2024 19:00:15 +0100 (CET) From: post@frankplowman.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Feb 2024 18:00:05 +0000 Message-ID: <20240205180005.12440-1-post@frankplowman.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-ZohoMailClient: External Subject: [FFmpeg-devel] [PATCH] lavc/vvc: Fix slice_idx out-of-bounds memset 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="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: Frank Plowman If the number of CTUs reduces between one picture and the next, the slice_idx table is reduced in size in the frame_context_for_each_tl call on vvcdec.c:321. When initialising the slice_idx table on vvcdec.c:325, the old code uses fc->tab.sz.ctu_count when calculating the table size. fc->tab.sz.ctu_count holds the old ctu count at this point however, not being updated to hold the new ctu count until vvcdec.c:342. This causes an out-of-bounds write. Patch fixes the problem by using pps->ctb_count, which was just used when allocating the table, in place of fc->tab.sz.ctu_count when initialising the table. Signed-off-by: Frank Plowman --- libavcodec/vvc/vvcdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vvc/vvcdec.c b/libavcodec/vvc/vvcdec.c index 1a050600eb..8163b5ecb6 100644 --- a/libavcodec/vvc/vvcdec.c +++ b/libavcodec/vvc/vvcdec.c @@ -322,7 +322,7 @@ static int pic_arrays_init(VVCContext *s, VVCFrameContext *fc) if (ret < 0) return ret; - memset(fc->tab.slice_idx, -1, sizeof(*fc->tab.slice_idx) * fc->tab.sz.ctu_count); + memset(fc->tab.slice_idx, -1, sizeof(*fc->tab.slice_idx) * ctu_count); if (fc->tab.sz.ctu_count != ctu_count) { ff_refstruct_pool_uninit(&fc->rpl_tab_pool); -- 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".