From nobody Tue Feb 10 19:50:25 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+53413+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1579518879239600.8568814405477; Mon, 20 Jan 2020 03:14:39 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id TYKhYY1788612xvhQqR4HWFO; Mon, 20 Jan 2020 03:14:38 -0800 X-Received: from EUR01-DB5-obe.outbound.protection.outlook.com (EUR01-DB5-obe.outbound.protection.outlook.com [40.107.15.49]) by mx.groups.io with SMTP id smtpd.web11.9085.1579518878030162615 for ; Mon, 20 Jan 2020 03:14:38 -0800 X-Received: from DB6PR0801CA0058.eurprd08.prod.outlook.com (2603:10a6:4:2b::26) by DB6PR0802MB2534.eurprd08.prod.outlook.com (2603:10a6:4:97::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20; Mon, 20 Jan 2020 11:14:35 +0000 X-Received: from AM5EUR03FT006.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::203) by DB6PR0801CA0058.outlook.office365.com (2603:10a6:4:2b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18 via Frontend Transport; Mon, 20 Jan 2020 11:14:35 +0000 Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+53413+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT006.mail.protection.outlook.com (10.152.16.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.23 via Frontend Transport; Mon, 20 Jan 2020 11:14:35 +0000 X-Received: ("Tessian outbound ca1df68f3668:v40"); Mon, 20 Jan 2020 11:14:35 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1fa2a57134a8f528 X-CR-MTA-TID: 64aa7808 X-Received: from b64afe7d4b3f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 31A6E7F0-9865-4474-8BE9-97D77CA34261.1; Mon, 20 Jan 2020 11:14:29 +0000 X-Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b64afe7d4b3f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 20 Jan 2020 11:14:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AMoh67ZJ1+j74kJxwJOuiw1PJOE4BvDmYxJ+EGLEUn4qfUr62hRn9v7JMwu6b2udV4vc/w94bLlEYUP+UEDdgdqSqHQLj0dhnQJi9PsvG/GY5fRCfxY4iDgS7JWiyt0vzMFCsjM+QDG6l0lRWxgCCtGT/TEbuaGCIpdDbJb2Rir619xC8FxMa+Ryrj8wTpl4hzv/N5fmT/wf9EOLIUb4Z9xG5H5Mn/imd3iSSAl6bHDT/eDkw9CtpdbgB5DTP9MHhMzXIgIqoOYGi0C9i5RpHRaIv5R/iLzLBiAbyYbM6eH4cyvQk83uXdTmM7uMjJp2bAwU0s1mI78IKYeZOGS9QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/FTqhOtiLfiZRClWBp0QTNU+yFX9jsMdLXV2T6oDsBg=; b=aJeAXyYYIHamSzdlimbKpIplyx3kXZmdelv6i+iDQleO8+INjHvw5DYleQNcIecPIr8bQeTl1XOUxjPwxHsxNabc9dK6ybsp4UrMJzZ6/pZFWatzsvCeLELvsSRBNDt07PtfBEBQoRHgLIliC9XAx5UPWsZUr9mktejtqDC6mHhQ5zDqzPiz8qxxNjlttDrOw3OgqakkwGyf0Yk2g8Qefqu/MqYpLR8wnqQeZX+JtFbyCsYMysjDYQQuwHG3PI09b6WHOQTfinbbnPse5/3FUSiRYi4xwNRK0cxzA/Bcrvqh78hXDsrGvGS+Efr7J6Jt2RfKUNdWxnyUptwdame3Cg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from VI1PR08CA0238.eurprd08.prod.outlook.com (2603:10a6:802:15::47) by AM6PR08MB4723.eurprd08.prod.outlook.com (2603:10a6:20b:c8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.19; Mon, 20 Jan 2020 11:14:28 +0000 X-Received: from AM5EUR03FT028.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::202) by VI1PR08CA0238.outlook.office365.com (2603:10a6:802:15::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.19 via Frontend Transport; Mon, 20 Jan 2020 11:14:28 +0000 Authentication-Results-Original: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT028.mail.protection.outlook.com (10.152.16.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2644.23 via Frontend Transport; Mon, 20 Jan 2020 11:14:27 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Mon, 20 Jan 2020 11:14:08 +0000 X-Received: from E119924.Arm.com (10.37.9.56) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Mon, 20 Jan 2020 11:14:08 +0000 From: "Krzysztof Koch" To: CC: , , , , Subject: [edk2-devel] [PATCH v3 10/11] ShellPkg: acpiview: GTDT: Validate global pointers before use Date: Mon, 20 Jan 2020 11:13:50 +0000 Message-ID: <20200120111351.29184-11-krzysztof.koch@arm.com> In-Reply-To: <20200120111351.29184-1-krzysztof.koch@arm.com> References: <20200120111351.29184-1-krzysztof.koch@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;IPV:;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(376002)(136003)(346002)(396003)(39860400002)(199004)(189003)(6666004)(356004)(7696005)(15650500001)(44832011)(86362001)(4326008)(5660300002)(186003)(70206006)(70586007)(6916009)(316002)(26005)(36756003)(2616005)(8676002)(81156014)(8936002)(81166006)(54906003)(478600001)(2906002)(1076003)(426003)(336012);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR08MB4723;H:nebula.arm.com;FPR:;SPF:Pass;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f6eaec7b-ef06-4562-d6b3-08d79d99ee89 X-MS-TrafficTypeDiagnostic: AM6PR08MB4723:|DB6PR0802MB2534: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:6430;OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: blMiSYVkpAiQTqJjT0KZM4E/isnFTIG+feD4thsChL/T90012bmefxQn80G2SUvhlFO+MZpFEXfnWFJ6o2vGYSG9QySHtMsBRhAR8Fr4dge65YgHcp4apA3PvlTgUFLGWGYYpyQvhPL8UTW6yvyVZ+ZOM4NCA/ppYygPHwD6qkIdlLgDSgy9DQUA9An2DaSIeBZRkLtmbz9z2RrNrMrpxSW8GM2OkjnDO62p64jgo527EztuMNd/qNDRlV8LsfRX399VwmUU/cFCUBRhghG/6zr4MaydnOUBtfJi0XctBqg5kCPC+KU7Yox2TSusEL711NwI8+0Zlkp6aGKvhtXZge1dJPEby9EDL7IhcW50LSACtL8jM9HpT6JgCjZz/qqUEa0nAEFEInoISR8kePTlspiMZ98JCQu5+rjDB7oL8H2SZxd+cKLXdyHWdPlbvO4V X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4723 Original-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 0078fe86-197a-4784-4085-08d79d99e9d7 X-Microsoft-Antispam-Message-Info: sIOcddS5oH3mE4MT+xqLiceBwiMr+69h2RozzHBy9XdGjRbZz4H6drco+0+azO71L8pfwqP/9zZl5aPy5r2/ByTfYy5YkJtUHsmf+GLVS+Qiwooo+REQ+ej73VkcIU5LzfZHxmH+00PsNCuObX2KlM3s18f9QrxtyXMmOkyLSA3D+G/bZb+cyzXOGmGwXC0+sY+TsCcUHk8DcNNar3b3oqXWHoM+POceH8rGay7l6bgzQt8IRkpnXhh/kurLFtwP59fgp1WJQWZ4bVzsbqtatJ3aNJ2lINTXVgqvrXpDevo3prssCzFMhLUHStcL2qpn0J3XC79djKvcy78lWalkyuYKowe2RSccHuFWeXlFxKzlt7KRm7zOU42WIuZHA/EdN3DdEAkl9+xd2zMxMYttCNoJdvlNStAsLRiAb8eUxyuqhizPpkog3bDgOJ3V3KwQ X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2020 11:14:35.3141 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6eaec7b-ef06-4562-d6b3-08d79d99ee89 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2534 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 X-Gm-Message-State: Eq8tqj0pD7uSxHx4pADy3FY3x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1579518878; bh=ZO/7eqEd/TJcEmOM9VawWL0Q8esmrlt0sT2ndpPsGjI=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=O7+fBpMUtDATOLUbBo37Qm0wJsbUEAOS9f9TrtT1JnOd/w38AZzKnq8JZ35HYOpg2BC aFHbgBcl98APD0TUS3m1xOWZ0KGRc7Uxk4rj2HguvqtGhdxdW90YD5rFYlYmul5/n5YJn cEUFXceFkUqr2qhe2eIfie4wpQ+b7/39rp4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Check if global (in the scope of the GTDT parser) pointers have been successfully updated before they are used for further table parsing. Signed-off-by: Krzysztof Koch --- Notes: v3: - Rebase on latest master [Krzysztof] v1: - Test against NULL pointers [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c | 3= 7 ++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/Gtdt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPa= rser.c index 57174e14c80072f12b90e1996ebe8f0002d0c404..699a55b549ec3fa61bbd1568988= 21055dc019199 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -189,6 +189,18 @@ DumpGTBlock ( PARSER_PARAMS (GtBlockParser) ); =20 + // Check if the values used to control the parsing logic have been + // successfully read. + if ((GtBlockTimerCount =3D=3D NULL) || + (GtBlockTimerOffset =3D=3D NULL)) { + IncrementErrorCount (); + Print ( + L"ERROR: Insufficient GT Block Structure length. Length =3D %d.\n", + Length + ); + return; + } + Offset =3D *GtBlockTimerOffset; Index =3D 0; =20 @@ -272,6 +284,18 @@ ParseAcpiGtdt ( PARSER_PARAMS (GtdtParser) ); =20 + // Check if the values used to control the parsing logic have been + // successfully read. + if ((GtdtPlatformTimerCount =3D=3D NULL) || + (GtdtPlatformTimerOffset =3D=3D NULL)) { + IncrementErrorCount (); + Print ( + L"ERROR: Insufficient table length. AcpiTableLength =3D %d.\n", + AcpiTableLength + ); + return; + } + TimerPtr =3D Ptr + *GtdtPlatformTimerOffset; Offset =3D *GtdtPlatformTimerOffset; Index =3D 0; @@ -290,6 +314,19 @@ ParseAcpiGtdt ( PARSER_PARAMS (GtPlatformTimerHeaderParser) ); =20 + // Check if the values used to control the parsing logic have been + // successfully read. + if ((PlatformTimerType =3D=3D NULL) || + (PlatformTimerLength =3D=3D NULL)) { + IncrementErrorCount (); + Print ( + L"ERROR: Insufficient remaining table buffer length to read the " \ + L"Platform Timer Structure header. Length =3D %d.\n", + AcpiTableLength - Offset + ); + return; + } + // Make sure the Platform Timer is inside the table. if ((Offset + *PlatformTimerLength) > AcpiTableLength) { IncrementErrorCount (); -- '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 (#53413): https://edk2.groups.io/g/devel/message/53413 Mute This Topic: https://groups.io/mt/69929578/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-