From nobody Sat Feb 7 05:56:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+84584+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+84584+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1639041928; cv=none; d=zohomail.com; s=zohoarc; b=TjzuUMu8efPX4sdTG0CeP8k393JPZcFo2FXS/CqsLQZucJSbOxDJbHlj51P07q39IT8a/UK8rN4Gg8yMPiit2HwBmvaztIPT+BKV8IfC/Swh6G/lNyDVDHmHNBzglrrP+y4w/cZMbfyNXy0CCHk/tnRsq8psoY77G7tpYGo5hBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639041928; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=PL8lCUTLgjSfa2UkgfGx9TMuJGnROG71Btp3oJSdQs4=; b=MlL5q7y7VDQdV1pWnxgmWBpAO/dLOpXAuBHw1aR+P+QyeDwUmx4tOviH/eYMKKuuETuB7RKfxw4KULYSocNrBfOEqA3Gth3ynvxGJwwvB4qh+JtGJwyghcVbscreN8eP1a5lUpqVWDGfYAmZiczL5Vz2CNwJscEidN2EX2sep64= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+84584+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1639041928630899.5023644003775; Thu, 9 Dec 2021 01:25:28 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id o7H0YY1788612xYnpcxSG1Dd; Thu, 09 Dec 2021 01:25:28 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.9253.1639041925532127964 for ; Thu, 09 Dec 2021 01:25:25 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 264CA1476; Thu, 9 Dec 2021 01:25:25 -0800 (PST) X-Received: from e126645.nice.arm.com (unknown [10.34.129.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5238D3F73B; Thu, 9 Dec 2021 01:25:24 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Alexei Fedorov Subject: [edk2-devel] [PATCH v4 8/8] DynamicTablesPkg: Fix multiple objects parsing Date: Thu, 9 Dec 2021 10:25:05 +0100 Message-Id: <20211209092505.1248326-9-Pierre.Gondois@arm.com> In-Reply-To: <20211209092505.1248326-1-Pierre.Gondois@arm.com> References: <20211209092505.1248326-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pierre.gondois@arm.com X-Gm-Message-State: jCLFotgYOyAL1iVu6rEQxpgnx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1639041928; bh=gZQ82Dq9vRN07wYMZ/5J/jV8pVe2Rwwcm7ntTkrTfYA=; h=Cc:Date:From:Reply-To:Subject:To; b=mM3GJXczJlMDgCOh4cVt0jaxkZ7vwt+HphmOCEIIsNKtLnauXT45j152ubaPRXllC9R 0H55TEaGtXbA5XJma9VbDO/jveiWvrFY/oBGKEiElvOks6NrvgLVXMBWm+dcXFfIjOhVA awqu8XMlqQyVlsdKzo9kbdKKWVD1iUwCyQA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1639041929703100030 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois When a CmObjDesc contains multiple objects, only the first one is parsed as the buffer doesn't progress. Fix this. Also check that the whole buffer has been parsed with an asset. Signed-off-by: Pierre Gondois --- Notes: v3: - New patch. [Pierre] .../ConfigurationManagerObjectParser.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationMa= nagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/Config= urationManagerObjectParser.c index 84a35e831471..c1b21d24a402 100644 --- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerOb= jectParser.c +++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerOb= jectParser.c @@ -688,6 +688,7 @@ ParseCmObjDesc ( UINT32 ObjIndex; UINT32 ObjectCount; INTN RemainingSize; + INTN Offset; CONST CM_OBJ_PARSER_ARRAY *ParserArray; =20 if ((CmObjDesc =3D=3D NULL) || (CmObjDesc->Data =3D=3D NULL)) { @@ -722,6 +723,7 @@ ParseCmObjDesc ( =20 ObjectCount =3D CmObjDesc->Count; RemainingSize =3D CmObjDesc->Size; + Offset =3D 0; =20 for (ObjIndex =3D 0; ObjIndex < ObjectCount; ObjIndex++) { DEBUG (( @@ -733,11 +735,21 @@ ParseCmObjDesc ( ObjectCount )); PrintCmObjDesc ( - CmObjDesc->Data, + (VOID *)((UINTN)CmObjDesc->Data + Offset), ParserArray->Parser, ParserArray->ItemCount, &RemainingSize, 1 ); + if ((RemainingSize > CmObjDesc->Size) || + (RemainingSize < 0)) + { + ASSERT (0); + return; + } + + Offset =3D CmObjDesc->Size - RemainingSize; } // for + + ASSERT (RemainingSize =3D=3D 0); } --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#84584): https://edk2.groups.io/g/devel/message/84584 Mute This Topic: https://groups.io/mt/87608851/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-