From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=LRh/k580; spf=pass (domain: arm.com, ip: 40.107.3.75, mailfrom: krzysztof.koch@arm.com) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (EUR03-AM5-obe.outbound.protection.outlook.com [40.107.3.75]) by groups.io with SMTP; Thu, 15 Aug 2019 06:11:58 -0700 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=+GOmkCOa5Q9giN5fQxdlPnuRpLknDkuM6KOCfU0vzkw=; b=LRh/k5801iWJGWNBep0TmCVKIPgrk5HfsuuYRSWVIvntFjRLHouP0kCgMBw8W+BeLKPDxRkYoBImVpQ2umQ65wdt3IcnzZUnCVWjmATNi9Mnul7SAO48TX1+mpWvM53iEm9/tEkDuwuh3DrzAKt0XnPXFt1AJwVJKghELd2QgU0= Received: from AM6PR08CA0011.eurprd08.prod.outlook.com (2603:10a6:20b:b2::23) by DB8PR08MB4956.eurprd08.prod.outlook.com (2603:10a6:10:e0::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2157.18; Thu, 15 Aug 2019 13:11:53 +0000 Received: from DB5EUR03FT063.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::206) by AM6PR08CA0011.outlook.office365.com (2603:10a6:20b:b2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2178.16 via Frontend Transport; Thu, 15 Aug 2019 13:11:53 +0000 Authentication-Results: spf=temperror (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=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT063.mail.protection.outlook.com (10.152.20.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2178.16 via Frontend Transport; Thu, 15 Aug 2019 13:11:51 +0000 Received: ("Tessian outbound 578a71fe5eaa:v26"); Thu, 15 Aug 2019 13:11:46 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0bd8637e47ef5715 X-CR-MTA-TID: 64aa7808 Received: from 14c8611bf911.1 (cr-mta-lb-1.cr-mta-net [104.47.0.58]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4CB743D6-172A-4522-984A-F03D44D2CC4F.1; Thu, 15 Aug 2019 13:11:40 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01lp2058.outbound.protection.outlook.com [104.47.0.58]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 14c8611bf911.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Thu, 15 Aug 2019 13:11:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hrVlOoac1zyU1rVS1a/Ki8zxbWIhyF69NXfWFx3Tstqz6vBwCIDo7/TvFzMi7x3MiNTyHs5re67zvYMZUKdV4IBm3PEjZTeqYHcwZduvbbTgvsvqlHsmFukteMV4k7Rs/5fn+MNUEwYb44AK4Uup2nwIIFtnSMpiyJTjzh58stjJt4/H9/JCcO+wLea4TRpVFYQKDjJmTO2cFTGKz9XygOYy1uhnHeFANW0VVMWk0qaPbBrkPy3jqAxQl3ewDUTuYJOpVew7i4TmDHIeAhKau7thDx7IhdDidzIJvoaeks3/ibvFfVB2/M2jRRw9iRH6Bhj4ib3T/MpOO8rXddNF0A== 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=+GOmkCOa5Q9giN5fQxdlPnuRpLknDkuM6KOCfU0vzkw=; b=PPJJC8UVnvlMemDN2YB60R2B1k3KEHEPsn8MyCTjXtVr6LZy5Dy7MY+tMUHDeMpBDH1qSiqrXP8b1oFaEyZqZkXCaKpKam4Ti1GcSmdj17kgdD8nT4sTWXXanLQ3ssePY9CXKQVh+Mf8aVwy80e8paT4yp2vEaqQY7dzmG9BI3Ov9OkbLSBFX2TJzRbB+uuppxeIRdERXfWPmA7yMF7uT5GoRFDgxCQ8lG1bMdeT15f7UnHpNCER3UPgl1+9x8h5nKzuPc9W6+8xTLWUX9Z1siMoH5RWSsiVYEr+0vtUhEOsMNKZ10FGuLpTLAGL2mSPSMm+Wsm8ClHBI1db3eqkIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=temperror (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=temperror 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=+GOmkCOa5Q9giN5fQxdlPnuRpLknDkuM6KOCfU0vzkw=; b=LRh/k5801iWJGWNBep0TmCVKIPgrk5HfsuuYRSWVIvntFjRLHouP0kCgMBw8W+BeLKPDxRkYoBImVpQ2umQ65wdt3IcnzZUnCVWjmATNi9Mnul7SAO48TX1+mpWvM53iEm9/tEkDuwuh3DrzAKt0XnPXFt1AJwVJKghELd2QgU0= Received: from AM6PR08CA0035.eurprd08.prod.outlook.com (2603:10a6:20b:c0::23) by AM5PR0801MB1843.eurprd08.prod.outlook.com (2603:10a6:203:3a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2157.20; Thu, 15 Aug 2019 13:11:37 +0000 Received: from DB5EUR03FT007.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::206) by AM6PR08CA0035.outlook.office365.com (2603:10a6:20b:c0::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2178.16 via Frontend Transport; Thu, 15 Aug 2019 13:11:37 +0000 Authentication-Results-Original: spf=temperror (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=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT007.mail.protection.outlook.com (10.152.20.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2178.16 via Frontend Transport; Thu, 15 Aug 2019 13:11:35 +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; Thu, 15 Aug 2019 13:11:34 +0000 Received: from E119924.Arm.com (10.1.199.124) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Thu, 15 Aug 2019 13:11:34 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [PATCH v1 03/11] ShellPkg: acpiview: FADT: Validate global pointer before use Date: Thu, 15 Aug 2019 14:11:13 +0100 Message-ID: <20190815131121.52644-4-krzysztof.koch@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20190815131121.52644-1-krzysztof.koch@arm.com> References: <20190815131121.52644-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:NLI;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(376002)(346002)(396003)(136003)(2980300002)(199004)(189003)(2351001)(47776003)(50226002)(53416004)(6666004)(50466002)(8936002)(6916009)(48376002)(36756003)(305945005)(356004)(70206006)(70586007)(446003)(81156014)(1076003)(186003)(126002)(63370400001)(44832011)(51416003)(63350400001)(81166006)(7696005)(54906003)(486006)(8676002)(5660300002)(11346002)(76176011)(16586007)(2616005)(426003)(53936002)(478600001)(4326008)(2906002)(15650500001)(476003)(316002)(26005)(336012)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR0801MB1843;H:nebula.arm.com;FPR:;SPF:TempError;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e5954133-3bae-4c87-ea13-08d72182233e X-Microsoft-Antispam-Untrusted: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328);SRVR:AM5PR0801MB1843; X-MS-TrafficTypeDiagnostic: AM5PR0801MB1843:|DB8PR08MB4956: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true X-MS-Oob-TLC-OOBClassifiers: OLM:5236;OLM:5236; X-Forefront-PRVS: 01304918F3 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: JgtGo8MS0qHSNzFeqJi31A2+5HVaQTU7SjmTmaNaIsXgegwHpVBbYwc8+x31hWpLMXsS+FwkJtr4H119wSPsfyo996sQ4aChtJagnVq6ddrpSepzdBupV5QzrlRrztHmTyyBCe7N6IU6BWinwm7AwSWOFMpvHyiM6WnppHM/4+1CBpnJcmFT8uKtGRRW6qUs7jBgDIQ8ftVksyA9DI1Tpm8evNnz3VACY7PDRN3uCGrm8xhcEze9BqprFoZCgv9difaHkGrNfsve0hyd0wA6FY9wdxMNPDruBZtBme7UNapE+J/mVC9ed9h9aXqPXV1QcP/dvzIMoA0qg8f0hkCEdde3fiS9PpIJJK+jKWxb1/oMymadh4ZTymg2C02LrS0/f0575ThpGew1cDt6WVqjMR5F74oq6Q48ZcHd+TONnQ0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1843 Original-Authentication-Results: spf=temperror (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=temperror action=none header.from=arm.com; Return-Path: Krzysztof.Koch@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT063.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)(396003)(39860400002)(136003)(376002)(346002)(2980300002)(189003)(199004)(51416003)(446003)(86362001)(76176011)(63370400001)(305945005)(26005)(15650500001)(426003)(2351001)(7696005)(44832011)(186003)(5660300002)(486006)(50466002)(6916009)(22756006)(1076003)(2906002)(336012)(53416004)(126002)(6666004)(48376002)(11346002)(2616005)(63350400001)(476003)(70206006)(81156014)(81166006)(50226002)(8676002)(54906003)(478600001)(26826003)(16586007)(8936002)(4326008)(36756003)(70586007)(316002)(47776003)(76130400001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB8PR08MB4956;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:TempError;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: bbe130e1-87a1-46e1-b6e2-08d7218219e3 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(710020)(711020)(4605104)(1401327)(2017052603328);SRVR:DB8PR08MB4956; NoDisclaimer: True X-Forefront-PRVS: 01304918F3 X-Microsoft-Antispam-Message-Info: Wb+mZJMLgxsZdlmQdsAB0/R8LM+pNqjFoEfCZM6cths/Wk/uYy3pAzR9JvS/d7oH6l5O8+xVw5IGZu3bbXLLoA9tfZzC/7zL1/MwjDUfNRNC9PKoEA6MBnYnxFsw3Y8VYIZsfQwhAMcD+dmKOMrwMDYrwHVVt/wopj5hFtYtGRXTcEGNzx1FpkrofHEvM//pXYw2UEeo+8VoZkp+HFDnNHHsG+8cTjQqiZADU1Hpy2++W21MaHC+rL41+EMVyDLURcNl8LNQ/4rdqfj+LkhgpEpm++X35Vv0q1+PITTLyACeTpy+IglMaQJsXRFD+Ne/DaDn9nYXg2uUsRMKTOnck8/4y6IlpBcfyhwje158IocspjHzR4HHt12KBHsQdM1TpzixQVjotLOwznAhGNNuWN4ozlUbUseKTxf0yQcO9OE= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2019 13:11:51.6444 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e5954133-3bae-4c87-ea13-08d72182233e 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: DB8PR08MB4956 Content-Type: text/plain Check if global pointers have been successfully updated before they are used for further table parsing. Signed-off-by: Krzysztof Koch --- Notes: v1: - Test against NULL pointers [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c index e40c9ef8ee4b3285faf8c6edf3cb6236ee367397..e218e45926abced1096e75441e22108db7a3a811 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c @@ -203,6 +203,20 @@ ParseAcpiFadt ( PARSER_PARAMS (FadtParser) ); + // Check if the values used to control the parsing logic have been + // successfully read. + if ((DsdtAddress == NULL) || + (FadtMinorRevision == NULL) || + (X_DsdtAddress == NULL)) { + IncrementErrorCount (); + Print ( + L"ERROR: Insufficient table length. AcpiTableLength = %d. " \ + L"FADT parsing aborted.\n", + AcpiTableLength + ); + return; + } + if (Trace) { Print (L"\nSummary:\n"); PrintFieldName (2, L"FADT Version"); -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'