From nobody Wed May 1 21:47:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43651+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1562914532; cv=none; d=zoho.com; s=zohoarc; b=NksS6kcq6VWqKUk10SjRap/4UowTbrlgt8sH4fzpwE6Honv0OWmWPJurZ9bFnIez1t6OGvK3gc7KldGpyk+6JGIaKVHeq/iulhegMk479hhtQOR/d0Yrf7ZLyNrJ2TwrnjXbTrZiVX2rVb/NOkLYM0GKsjY2sPjb9tdmw6TriaQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562914532; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=Sd64oHTLhcN5iJFBr/enKQ3KuZZ2TTTJEN458eHIAaM=; b=WoC24l+MBbX3llUhXhV3svkbr+GObVEmOxahCqEkLkkblHb4eRrCb/1ror+I+ZlN/TsQGbbCLPlKnkB83KtEz70Cz+qCrur43aMw2W+5b/xJ+UEgQELxvDvLyug2tlfPcpudTA9Xo2ba4RmOXJ6Wrk68y8wmMc9xf750GDqioC8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43651+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1562914532691485.03160072272; Thu, 11 Jul 2019 23:55:32 -0700 (PDT) Return-Path: X-Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.44]) by groups.io with SMTP; Thu, 11 Jul 2019 23:55:31 -0700 X-Received: from VI1PR08CA0094.eurprd08.prod.outlook.com (2603:10a6:800:d3::20) by VE1PR08MB4958.eurprd08.prod.outlook.com (2603:10a6:803:110::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.18; Fri, 12 Jul 2019 06:55:26 +0000 X-Received: from DB5EUR03FT060.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::203) by VI1PR08CA0094.outlook.office365.com (2603:10a6:800:d3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2073.10 via Frontend Transport; Fri, 12 Jul 2019 06:55:26 +0000 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+43651+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) X-Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT060.mail.protection.outlook.com (10.152.21.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2052.18 via Frontend Transport; Fri, 12 Jul 2019 06:55:25 +0000 X-Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Fri, 12 Jul 2019 06:53:23 +0000 X-Received: from E119924.Arm.com (10.37.8.167) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Fri, 12 Jul 2019 06:53:23 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [edk2-devel] [PATCH v1 11/11] ShellPkg: acpiview: DBG2: Add error-checking in the parsing logic Date: Fri, 12 Jul 2019 07:52:43 +0100 Message-ID: <20190712065243.3812-12-krzysztof.koch@arm.com> In-Reply-To: <20190712065243.3812-1-krzysztof.koch@arm.com> References: <20190712065243.3812-1-krzysztof.koch@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 778f16d0-f326-4d54-5bec-08d70695eaaf X-MS-TrafficTypeDiagnostic: VE1PR08MB4958: X-MS-Exchange-PUrlCount: 1 X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:462; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: z4OjgNt1qAktcEufM77AG3RGoPhEfZfZOsWu4do90llBdAvXlr70Bzeh3/5GNNwlS84auoG/f66TJjpoMz7qPIww4Ro6GNgPJD2lkFhp+RMDcUFMcokuwj2trhrxt1lQuPetz9FKwbJUblrXwvoFVKHvuxjW1bh2FPVLFoUsu0vCXm1ocLTBF0PH26XuESEvRlHSzHKvQoLDcaA3FAoc3aDKLLNow1KKQoh0JbYGuKrF4TT5d3xBY9whtXbkNSU92EfvnSuIiRnuQtyI+Hl4jWP0WSzJI7bohoTlkr0ShmAjGod2TsVJyVfvRwyVtBTPk498kbKfpmHb2kaIO8pMSlfBklmzeeDyrubVdN+WERAiSAkyG8oDj1xW71l5YhaPz3ONLHouRpo3H82ZLDuRNVXOk6IfSYO4OTgrJWYuNI4= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2019 06:55:25.3339 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 778f16d0-f326-4d54-5bec-08d70695eaaf X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[40.67.248.234];Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4958 Precedence: Bulk List-Unsubscribe: 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,krzysztof.koch@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1562914532; bh=xUDbvBHmcpkvhA9cB6y9iRfJuf4Z3AP8q4MuWqapnrM=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=p1OJKP8yL/10+zgRGtfLZvhFuOx2zUcfSG3JMCxQ1W7Lgw9k2PqKgLwxmCU3mTzA65L F7j2D4wPaT3QG4OKctA3C5XSIRFS2G25ANpZSWf0z0MGHd2yhC/3j9KeJNZGXSLgy2EkY AVJNC3lpkcBSrkw1D40YmnjFOWkz4A+zOJA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 1. Check if the global pointers (in the scope of this ACPI table parser) have been successfully updated before they are later used to control the parsing logic. 2. Remove redundant forward function declarations by repositioning blocks of code. 3. Test against buffer overruns. 4. Introduce a ACPI_PARSER array for parsing the header of the debug device information structure. This way, the length of the buffer storing a debug device information structure instance can be passed to DumpDbgDeviceInfo(). Consequently, the parsing logic becomes consistent with other ACPI table parsers and tests against buffer overrruns are simpler to implement. 5. Modify the signature of DumpGasStruct() function inside AcpiParser.c to facilitate protection against buffer overruns in the DBG2 parser. Signed-off-by: Krzysztof Koch Reviewed-by: Alexei Fedorov --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/530b0= 59a9fe4aa9f1df36b407f97d76acaab8b74 Notes: v1: - improve the logic in the DBG2 parser [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | = 26 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h | = 8 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c | 2= 98 ++++++++++++++------ 3 files changed, 225 insertions(+), 107 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index 8b3153516d2b7d9b920ab2de0344c17798ac572c..2d6ff80e299eebe7853061d3db8= 9332197c0dc0e 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -589,23 +589,27 @@ STATIC CONST ACPI_PARSER GasParser[] =3D { =20 @param [in] Ptr Pointer to the start of the buffer. @param [in] Indent Number of spaces to indent the output. + @param [in] Length Length of the GAS structure buffer. + + @retval Number of bytes parsed. **/ -VOID +UINT32 EFIAPI DumpGasStruct ( IN UINT8* Ptr, - IN UINT32 Indent + IN UINT32 Indent, + IN UINT32 Length ) { Print (L"\n"); - ParseAcpi ( - TRUE, - Indent, - NULL, - Ptr, - GAS_LENGTH, - PARSER_PARAMS (GasParser) - ); + return ParseAcpi ( + TRUE, + Indent, + NULL, + Ptr, + Length, + PARSER_PARAMS (GasParser) + ); } =20 /** @@ -621,7 +625,7 @@ DumpGas ( IN UINT8* Ptr ) { - DumpGasStruct (Ptr, 2); + DumpGasStruct (Ptr, 2, GAS_LENGTH); } =20 /** diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index 7657892d9fd2e2e14c6578611ff0cf1b6f6cd750..20ca358bddfa5953bfb1d1bebae= bbf3079eaba01 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -405,12 +405,16 @@ ParseAcpi ( =20 @param [in] Ptr Pointer to the start of the buffer. @param [in] Indent Number of spaces to indent the output. + @param [in] Length Length of the GAS structure buffer. + + @retval Number of bytes parsed. **/ -VOID +UINT32 EFIAPI DumpGasStruct ( IN UINT8* Ptr, - IN UINT32 Indent + IN UINT32 Indent, + IN UINT32 Length ); =20 /** diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Pa= rser.c index 8de5ebf74775bab8e765849cba6ef4eb6f659a5a..2bbd622ffb7cec0a340de3e10bd= cd01ba4d330df 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c @@ -12,6 +12,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiView.h" =20 // Local variables pointing to the table fields STATIC CONST UINT32* OffsetDbgDeviceInfo; @@ -27,7 +28,7 @@ STATIC CONST UINT16* AddrSizeOffset; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; =20 /** - This function Validates the NameSpace string length. + This function validates the NameSpace string length. =20 @param [in] Ptr Pointer to the start of the buffer. @param [in] Context Pointer to context specific information e.g. this @@ -37,24 +38,23 @@ STATIC VOID EFIAPI ValidateNameSpaceStrLen ( - IN UINT8* Ptr, - IN VOID* Context - ); + IN UINT8* Ptr, + IN VOID* Context + ) +{ + UINT16 NameSpaceStrLen; =20 -/** - This function parses the debug device information structure. + NameSpaceStrLen =3D *(UINT16*)Ptr; =20 - @param [in] Ptr Pointer to the start of the buffer. - @param [out] Length Pointer in which the length of the debug - device information is returned. -**/ -STATIC -VOID -EFIAPI -DumpDbgDeviceInfo ( - IN UINT8* Ptr, - OUT UINT32* Length - ); + if (NameSpaceStrLen < 2) { + IncrementErrorCount (); + Print ( + L"\nERROR: NamespaceString Length =3D %d. If no Namespace device exi= sts, " \ + L"NamespaceString[] must contain a period '.'", + NameSpaceStrLen + ); + } +} =20 /// An ACPI_PARSER array describing the ACPI DBG2 table. STATIC CONST ACPI_PARSER Dbg2Parser[] =3D { @@ -65,10 +65,17 @@ STATIC CONST ACPI_PARSER Dbg2Parser[] =3D { (VOID**)&NumberDbgDeviceInfo, NULL, NULL} }; =20 +/// An ACPI_PARSER array describing the debug device information structure +/// header. +STATIC CONST ACPI_PARSER DbgDevInfoHeaderParser[] =3D { + {L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Length", 2, 1, L"%d", NULL, (VOID**)&DbgDevInfoLen, NULL, NULL} +}; + /// An ACPI_PARSER array describing the debug device information. STATIC CONST ACPI_PARSER DbgDevInfoParser[] =3D { {L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Length", 2, 1, L"%d", NULL, (VOID**)&DbgDevInfoLen, NULL, NULL}, + {L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL}, =20 {L"Generic Address Registers Count", 1, 3, L"0x%x", NULL, (VOID**)&GasCount, NULL, NULL}, @@ -91,108 +98,152 @@ STATIC CONST ACPI_PARSER DbgDevInfoParser[] =3D { (VOID**)&AddrSizeOffset, NULL, NULL} }; =20 -/** - This function validates the NameSpace string length. - - @param [in] Ptr Pointer to the start of the buffer. - @param [in] Context Pointer to context specific information e.g. this - could be a pointer to the ACPI table header. -**/ -STATIC -VOID -EFIAPI -ValidateNameSpaceStrLen ( - IN UINT8* Ptr, - IN VOID* Context - ) -{ - UINT16 NameSpaceStrLen; - - NameSpaceStrLen =3D *(UINT16*)Ptr; - - if (NameSpaceStrLen < 2) { - IncrementErrorCount (); - Print ( - L"\nERROR: NamespaceString Length =3D %d. If no Namespace device exi= sts,\n" - L" then NamespaceString[] must contain a period '.'", - NameSpaceStrLen - ); - } -} - /** This function parses the debug device information structure. =20 - @param [in] Ptr Pointer to the start of the buffer. - @param [out] Length Pointer in which the length of the debug - device information is returned. + @param [in] Ptr Pointer to the start of the buffer. + @param [in] Length Length of the debug device information structure. **/ STATIC VOID EFIAPI DumpDbgDeviceInfo ( - IN UINT8* Ptr, - OUT UINT32* Length + IN UINT8* Ptr, + IN UINT16 Length ) { UINT16 Index; - UINT8* DataPtr; - UINT32* AddrSize; - - // Parse the debug device info to get the Length - ParseAcpi ( - FALSE, - 0, - "Debug Device Info", - Ptr, - 3, // Length is 2 bytes starting at offset 1 - PARSER_PARAMS (DbgDevInfoParser) - ); + UINT16 Offset; =20 ParseAcpi ( TRUE, 2, "Debug Device Info", Ptr, - *DbgDevInfoLen, + Length, PARSER_PARAMS (DbgDevInfoParser) ); =20 - // GAS and Address Size + // Check if the values used to control the parsing logic have been + // successfully read. + if ((GasCount =3D=3D NULL) || + (NameSpaceStringLength =3D=3D NULL) || + (NameSpaceStringOffset =3D=3D NULL) || + (OEMDataLength =3D=3D NULL) || + (OEMDataOffset =3D=3D NULL) || + (BaseAddrRegOffset =3D=3D NULL) || + (AddrSizeOffset =3D=3D NULL)) { + IncrementErrorCount (); + Print ( + L"ERROR: Insufficient Debug Device Information Structure length. " \ + L"Length =3D %d.\n", + Length + ); + return; + } + + // GAS Index =3D 0; - DataPtr =3D Ptr + (*BaseAddrRegOffset); - AddrSize =3D (UINT32*)(Ptr + (*AddrSizeOffset)); - while (Index < (*GasCount)) { + Offset =3D *BaseAddrRegOffset; + while ((Index++ < *GasCount) && + (Offset < Length)) { PrintFieldName (4, L"BaseAddressRegister"); - DumpGasStruct (DataPtr, 4); + Offset +=3D (UINT16)DumpGasStruct ( + Ptr + Offset, + 4, + Length - Offset + ); + } + + // Cross-check the substructure count with the length of the encapsulati= ng + // buffer + if (GetConsistencyChecking () && + (Index < *GasCount)) { + IncrementErrorCount (); + Print ( + L"ERROR: Invalid GAS count. GasCount =3D %d. DbgDevInfoLen =3D %d.\n= ", + *GasCount, + Length + ); + return; + } + + // Make sure the array of address sizes corresponding to each GAS fit in= the + // Debug Device Information structure + if ((*AddrSizeOffset + (*GasCount * sizeof (UINT32))) > Length) { + IncrementErrorCount (); + Print ( + L"ERROR: Invalid GAS count. GasCount =3D %d. RemainingBufferLength = =3D %d. " \ + L"Parsing of the Debug Device Information structure aborted.\n", + *GasCount, + Length - *AddrSizeOffset + ); + return; + } + + // Address Size + Index =3D 0; + Offset =3D *AddrSizeOffset; + while ((Index++ < *GasCount) && + (Offset < Length)) { PrintFieldName (4, L"Address Size"); - Print (L"0x%x\n", AddrSize[Index]); - DataPtr +=3D GAS_LENGTH; - Index++; + Print (L"0x%x\n", *((UINT32*)(Ptr + Offset))); + Offset +=3D sizeof (UINT32); } =20 // NameSpace String Index =3D 0; - DataPtr =3D Ptr + (*NameSpaceStringOffset); + Offset =3D *NameSpaceStringOffset; PrintFieldName (4, L"NameSpace String"); - while (Index < (*NameSpaceStringLength)) { - Print (L"%c", DataPtr[Index++]); + while ((Index++ < *NameSpaceStringLength) && + (Offset < Length)) { + Print (L"%c", *(Ptr + Offset)); + Offset++; } Print (L"\n"); =20 + // Cross-check the string length with the size of the encapsulating + // buffer + if (GetConsistencyChecking () && + (Index < *NameSpaceStringLength)) { + IncrementErrorCount (); + Print ( + L"ERROR: Invalid NameSpaceString length. NameSpaceStringLength =3D %= d. " \ + L"DbgDevInfoLen =3D %d.\n", + *NameSpaceStringLength, + Length + ); + return; + } + // OEM Data - Index =3D 0; - DataPtr =3D Ptr + (*OEMDataOffset); - PrintFieldName (4, L"OEM Data"); - while (Index < (*OEMDataLength)) { - Print (L"%x ", DataPtr[Index++]); - if ((Index & 7) =3D=3D 0) { - Print (L"\n%-*s ", OUTPUT_FIELD_COLUMN_WIDTH, L""); + if (*OEMDataOffset !=3D 0) { + Index =3D 0; + Offset =3D *OEMDataOffset; + PrintFieldName (4, L"OEM Data"); + while ((Index++ < *OEMDataLength) && + (Offset < Length)) { + Print (L"%x ", *(Ptr + Offset)); + if ((Index & 7) =3D=3D 0) { + Print (L"\n%-*s ", OUTPUT_FIELD_COLUMN_WIDTH, L""); + } + Offset++; } + Print (L"\n"); } - Print (L"\n"); =20 - *Length =3D *DbgDevInfoLen; + // Cross-check the OEM data length with the size of the encapsulating + // buffer + if (GetConsistencyChecking () && + (Index < *OEMDataLength)) { + IncrementErrorCount (); + Print ( + L"ERROR: Invalid OEM Data size. OEMDataLength =3D %d. " \ + L"DbgDevInfoLen =3D %d.\n", + *OEMDataLength, + Length + ); + } } =20 /** @@ -217,8 +268,7 @@ ParseAcpiDbg2 ( ) { UINT32 Offset; - UINT32 DbgDeviceInfoLength; - UINT8* DevInfoPtr; + UINT32 Index; =20 if (!Trace) { return; @@ -232,14 +282,74 @@ ParseAcpiDbg2 ( AcpiTableLength, PARSER_PARAMS (Dbg2Parser) ); - DevInfoPtr =3D Ptr + Offset; =20 - while (Offset < AcpiTableLength) { - DumpDbgDeviceInfo ( - DevInfoPtr, - &DbgDeviceInfoLength + // Check if the values used to control the parsing logic have been + // successfully read. + if ((OffsetDbgDeviceInfo =3D=3D NULL) || + (NumberDbgDeviceInfo =3D=3D NULL)) { + IncrementErrorCount (); + Print ( + L"ERROR: Insufficient table length. AcpiTableLength =3D %d\n", + AcpiTableLength + ); + return; + } + + Offset =3D *OffsetDbgDeviceInfo; + Index =3D 0; + + while (Index++ < *NumberDbgDeviceInfo) { + + // Parse the Debug Device Information Structure header to obtain Length + ParseAcpi ( + FALSE, + 0, + NULL, + Ptr + Offset, + AcpiTableLength - Offset, + PARSER_PARAMS (DbgDevInfoHeaderParser) + ); + + // Check if the values used to control the parsing logic have been + // successfully read. + if (DbgDevInfoLen =3D=3D NULL) { + IncrementErrorCount (); + Print ( + L"ERROR: Insufficient remaining table buffer length to read the " \ + L"Debug Device Information structure's 'Length' field. " \ + L"RemainingTableBufferLength =3D %d.\n", + AcpiTableLength - Offset + ); + return; + } + + // Make sure the Debug Device Information structure lies inside the ta= ble. + if ((Offset + *DbgDevInfoLen) > AcpiTableLength) { + IncrementErrorCount (); + Print ( + L"ERROR: Invalid Debug Device Information structure length. " \ + L"DbgDevInfoLen =3D %d. RemainingTableBufferLength =3D %d. " \ + L"DBG2 parsing aborted.\n", + *DbgDevInfoLen, + AcpiTableLength - Offset + ); + return; + } + + DumpDbgDeviceInfo (Ptr + Offset, (*DbgDevInfoLen)); + Offset +=3D (*DbgDevInfoLen); + } + + // Cross-check the substructure count with the length of the encapsulati= ng + // buffer + if (GetConsistencyChecking () && + (Index < *NumberDbgDeviceInfo)) { + IncrementErrorCount (); + Print ( + L"ERROR: Invalid Debug Device Information structure count. " \ + L"NumberDbgDeviceInfo =3D %d. AcpiTableLength =3D %d.\n", + *NumberDbgDeviceInfo, + AcpiTableLength ); - Offset +=3D DbgDeviceInfoLength; - DevInfoPtr +=3D DbgDeviceInfoLength; } } -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=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 (#43651): https://edk2.groups.io/g/devel/message/43651 Mute This Topic: https://groups.io/mt/32439516/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-