From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.40]) by mx.groups.io with SMTP id smtpd.web10.9239.1579518876820553135 for ; Mon, 20 Jan 2020 03:14:37 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=IteaXFR9; spf=pass (domain: arm.com, ip: 40.107.20.40, mailfrom: krzysztof.koch@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qqHQTBAB+4Z+UQEy0zTUs4AensblqJ6ugLj2sXlYk1g=; b=IteaXFR9H3Cfm1ZRX5Lu40Me4YpyH0Fob4zoott907Kkd9jqQgDB+s5qfQwV/NkSp6WgkFPCDVDhevj3uVDEvYraRoNkOEmtBjrZdW7WoK7XoI1Q5OYtfDCZ7tsZBixvRf6/Q6QSY0CcgBw5W5byu/ZnGkXaoQOy5bDY6remz5g= Received: from VI1PR08CA0184.eurprd08.prod.outlook.com (2603:10a6:800:d2::14) by DB6PR08MB2791.eurprd08.prod.outlook.com (2603:10a6:6:17::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.23; Mon, 20 Jan 2020 11:14:21 +0000 Received: from DB5EUR03FT004.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::208) by VI1PR08CA0184.outlook.office365.com (2603:10a6:800:d2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20 via Frontend Transport; Mon, 20 Jan 2020 11:14:20 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; 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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT004.mail.protection.outlook.com (10.152.20.128) 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:20 +0000 Received: ("Tessian outbound 4f3bc9719026:v40"); Mon, 20 Jan 2020 11:14:20 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 297e1c001937e0f5 X-CR-MTA-TID: 64aa7808 Received: from 0c3ccb0f8316.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3EBA7CF2-4B5A-43D8-8A67-0DDF2300EB5D.1; Mon, 20 Jan 2020 11:14:15 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0c3ccb0f8316.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 20 Jan 2020 11:14:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tj0vWaiPLhf1vd1INmQRj6kz7iFIU99IfBO6FJnMXX5YdRjyZO7YXM9PvVwsNmwGyltmBY6dm03QYwike78vnJR+iBt1lmQdffJ+FoHJXoMx61ECIhRC9OTf6VN72H3dl/IeeTQ0F/7JQWSBGY1O8UdTfbu7L5QkWIGrvSLSiRLXDdYgUnI0KgBkG4yqnm5Y3UMs9OBR5R/Sj1eJ8WwT3KHn1Jb0NVzM160FvVVORRvoNCh0yYkFhdJmlJ4JFlCvu8m7s+tERGCmM9gU7cRJxnfpbGwr8magcaQMbMjwlqB/i2HYQZeWkny5ZoKTY2Se6ivNtajKgg9ifa2kWywwPg== 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=qqHQTBAB+4Z+UQEy0zTUs4AensblqJ6ugLj2sXlYk1g=; b=OJ0/Sh7Yg21AoxbVBjzYeSnGIOIUV5H5tJRTAdr05KUFoAZe1jmVhn7vQRlYN24qexZRWOE+L8fThWNuNc0mnqZqYFkFNAUh4QurAHmLR9QN34t6j19OP3RoLwlzzSdK18SLYQQD/ka/HgQTMtIJ9sq3NpMkqnnTNzaOXc50lyxOwtpfrLGhJkLnYXY/LZIcz5hmT9c1GCS8ojQVnQ8SGFLhfbeAxSzIma+b2uf+8gp2EcXmPGK6s3TfHhpJTzmOtfrlYvulAVgylOROLlujI5X2pSYdCT1o8/Lb0cmX8TWXlUjjS3kbb84YZrSKtqXGxGSH7z+aXvVFEfQXeZiiLw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qqHQTBAB+4Z+UQEy0zTUs4AensblqJ6ugLj2sXlYk1g=; b=IteaXFR9H3Cfm1ZRX5Lu40Me4YpyH0Fob4zoott907Kkd9jqQgDB+s5qfQwV/NkSp6WgkFPCDVDhevj3uVDEvYraRoNkOEmtBjrZdW7WoK7XoI1Q5OYtfDCZ7tsZBixvRf6/Q6QSY0CcgBw5W5byu/ZnGkXaoQOy5bDY6remz5g= Received: from VI1PR0802CA0024.eurprd08.prod.outlook.com (2603:10a6:800:aa::34) by DB8PR08MB4986.eurprd08.prod.outlook.com (2603:10a6:10:e0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.23; Mon, 20 Jan 2020 11:14:13 +0000 Received: from VE1EUR03FT059.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::209) by VI1PR0802CA0024.outlook.office365.com (2603:10a6:800:aa::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.20 via Frontend Transport; Mon, 20 Jan 2020 11:14:13 +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; Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT059.mail.protection.outlook.com (10.152.19.60) 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:13 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) 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; Mon, 20 Jan 2020 11:14:04 +0000 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:04 +0000 From: "Krzysztof Koch" To: CC: , , , , Subject: [PATCH v3 02/11] ShellPkg: acpiview: RSDP: Validate global pointer before use Date: Mon, 20 Jan 2020 11:13:42 +0000 Message-ID: <20200120111351.29184-3-krzysztof.koch@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 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)(346002)(136003)(39860400002)(376002)(396003)(189003)(199004)(26005)(186003)(2616005)(6666004)(356004)(7696005)(426003)(336012)(44832011)(4326008)(316002)(70586007)(70206006)(8676002)(81166006)(8936002)(6916009)(81156014)(1076003)(36756003)(15650500001)(478600001)(86362001)(2906002)(54906003)(5660300002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB8PR08MB4986;H:nebula.arm.com;FPR:;SPF:Pass;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fcbbda4a-fd67-4d25-b1e8-08d79d99e5da X-MS-TrafficTypeDiagnostic: DB8PR08MB4986:|DB6PR08MB2791: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:6790;OLM:6790; X-Forefront-PRVS: 0288CD37D9 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 0ZRYyQ0m7X8/C7DFCr+WgMRzLhSSdZORTi8rUR9G2RQCkQuIGl9WmG5ds1pv2KB0IYFGhO5/Yx6PcuhxA/SFQhS/xonBJMj68lfSghLsfjU87Kg5ezyXrgjcaeMfrSyXhTj4DdCVoirDcuHVfymSboubRbnAR4o/Vl5MAEaNcbgSMpKlPwjs2pSch3rdROBKuDSeomqRHHuQB8Ggu+IEPtqJXwdKzDYON1Gz/Hj/EdhYt7kCrilkDw0tOUlaRsHUBkoZjbAI/NNPRYQtE+0XFQwloIlYH/E0efsYpROQWgPSeNO8u61y03NddzgP+mohXnFpSlO113oyL6D+lu1q/DeMc5hespA3qBe7tIj0xq0FhiwfKJy2mYwlAsO+PTQOrfuC+Ga0ugrKNqpXfwhw2BQib6ISuZquI2CtRA6x1VVv5VrdLnQcnfPS2XpybLve X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4986 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; Return-Path: Krzysztof.Koch@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT004.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;IPV:CAL;SCL:-1;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(376002)(346002)(396003)(136003)(39860400002)(189003)(199004)(426003)(26005)(6666004)(7696005)(44832011)(186003)(2906002)(2616005)(86362001)(316002)(4326008)(336012)(5660300002)(26826003)(70586007)(70206006)(36756003)(54906003)(15650500001)(478600001)(81156014)(81166006)(8936002)(6916009)(1076003)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR08MB2791;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:Pass;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;MX:1;A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 0b9698b7-435c-4997-8a31-08d79d99e14c X-Forefront-PRVS: 0288CD37D9 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ib5mAw1Ze5Xxa6frD7vOb5mUdMIWvuaWfLp2CoOAXxaXR0DXx+LPpsB1iP+dqAzFCF7Zudb1j6hxntTMGCdqclWVTBva05uw3a1/VVwPKBZMb2gcIIo6JmyNVXQpuZ4/gpDZ/KbWxvbkObujLGMzMPDQ5wmCqgPLGby3TYnjAbAduRdjRbMnIH0/6Qg8jq+WSGgcSoWaBlajwxVU2ZIALQucYFJYoU6sB3C7HZZKBk9x7D7ruUfT/2D6ndZ5fBDMAHECoYasIjTSEMC9grcyNLPZpqiJek0y4AnPTiBQWPpmxxDRclrePXwyQDZ15UyZ1/jnqj/T/quD70xqLlA35YjzNtj4NzRQTHEybPtKkHBHkSdwo9pgrdQ+vH8Jlyeoaz4Z8Mc24d3H9xBLeOGBIF6GqNa9l+LCx7cP79GdFXiYBPU3lYZD9zmOPeQG+KUr X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2020 11:14:20.7576 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fcbbda4a-fd67-4d25-b1e8-08d79d99e5da 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: DB6PR08MB2791 Content-Type: text/plain Check if XsdtAddress pointer has been successfully updated before it is 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/Rsdp/RsdpParser.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c index 5a5c4b50c12e6eb0aa0efb1765df7e123f614da3..f4a8732a7db7c437031f2a3d2f266b80eff17b4b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c @@ -138,6 +138,18 @@ ParseAcpiRsdp ( PARSER_PARAMS (RsdpParser) ); + // Check if the values used to control the parsing logic have been + // successfully read. + if (XsdtAddress == NULL) { + IncrementErrorCount (); + Print ( + L"ERROR: Insufficient table length. AcpiTableLength = %d." \ + L"RSDP parsing aborted.\n", + AcpiTableLength + ); + return; + } + // This code currently supports parsing of XSDT table only // and does not parse the RSDT table. Platforms provide the // RSDT to enable compatibility with ACPI 1.0 operating systems. -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'