From nobody Tue Feb 10 15:28:26 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+53411+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 1579518875267929.4499275592964; Mon, 20 Jan 2020 03:14:35 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id qgY0YY1788612xuVeiVQHUnI; Mon, 20 Jan 2020 03:14:34 -0800 X-Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.47]) by mx.groups.io with SMTP id smtpd.web09.9177.1579518874049928811 for ; Mon, 20 Jan 2020 03:14:34 -0800 X-Received: from VI1PR0802CA0019.eurprd08.prod.outlook.com (2603:10a6:800:aa::29) by VI1PR0801MB1792.eurprd08.prod.outlook.com (2603:10a6:800:50::21) 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:31 +0000 X-Received: from AM5EUR03FT052.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::205) by VI1PR0802CA0019.outlook.office365.com (2603:10a6:800:aa::29) 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:31 +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+53411+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 AM5EUR03FT052.mail.protection.outlook.com (10.152.17.161) 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:31 +0000 X-Received: ("Tessian outbound e09e55c05044:v40"); Mon, 20 Jan 2020 11:14:31 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 84e9489c0f5561e3 X-CR-MTA-TID: 64aa7808 X-Received: from 9a8575fd3acb.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1005BD7F-B702-4513-9537-68A61EF2C189.1; Mon, 20 Jan 2020 11:14:25 +0000 X-Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9a8575fd3acb.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 20 Jan 2020 11:14:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iS3T51/aVp99IMFK5ezcNTVyTL6lE9os6tTx3xw43ZFjYCw+bdYsK7+CKCIx7hbIVxUtwze69oRPm3wzyFx+amXj29cdymTPtgPyamOkF1CWPgOHj+KY2FrWhj2k7olAjx5KCSHDIWFg6b4nQqozS4fzzwL4SWf8vaXhl9lJJOTL9KNyjxbDdmjZ8+TVDjtFoFvXLdPLneai7kM3JrkDuFu3WMxFmK942wBVT0NsP0ENxEMVr+ven8pcMFZIgUQyGSLBnNH5e/DMTaNvlPzsf/cgMSxAKX15mIab6Helz47Wdi1NyY/w7aTwqKmtnGiMAoX6xseGQML9WeQ0O+B3xQ== 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=nUAaYzvZT/i5TNxH9xD6u4DN5SbwYKTRGqsLp9d5N1E=; b=X8ySt/L4/jqxdPii+FyEse6h3MnZL0XAfwjsv+BG+ksu5bW+UAn/tMZ+LrVkLXV7GvbPY+CO2cGoQbsxloVU6aTF8KwZbgRDfPyRTDq5v27UYfesp5eXXoulC1eEEvra333A2mli1lwS2XZS7hL0hs8i0+QTOq2Si7PdyyWHtgAuXC3s4ZHMbuDrIu4n+r1+xwKy2rAfPbwh/AMMoXhZO0YR2rZrgNwCW+nXorLsccIvsAQ1A9OnZVUjO08PWm0GKhquBvaRQgvDG4FImAdpVgZccdH2z1leL4rfspUAtBalNzU7Ffq9NSNKV0I037mLfW/IsUf0PXwTK3WjBwU6XQ== 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 VI1PR08CA0228.eurprd08.prod.outlook.com (2603:10a6:802:15::37) by AM6PR08MB3128.eurprd08.prod.outlook.com (2603:10a6:209:45::20) 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:24 +0000 X-Received: from AM5EUR03FT028.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::203) by VI1PR08CA0228.outlook.office365.com (2603:10a6:802:15::37) 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:24 +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:23 +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:06 +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:06 +0000 From: "Krzysztof Koch" To: CC: , , , , Subject: [edk2-devel] [PATCH v3 06/11] ShellPkg: acpiview: SRAT: Validate global pointers before use Date: Mon, 20 Jan 2020 11:13:46 +0000 Message-ID: <20200120111351.29184-7-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)(136003)(39860400002)(376002)(346002)(396003)(189003)(199004)(81156014)(81166006)(8676002)(478600001)(86362001)(1076003)(356004)(6666004)(6916009)(8936002)(70586007)(70206006)(26005)(7696005)(44832011)(2616005)(36756003)(54906003)(316002)(2906002)(5660300002)(336012)(426003)(4326008)(186003)(15650500001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR08MB3128;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: 6aebd011-5e6b-462b-2c6a-08d79d99ec43 X-MS-TrafficTypeDiagnostic: AM6PR08MB3128:|VI1PR0801MB1792: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:3513;OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: mu+GbLgwFaEh+LswlNS36+z/2jfeZlBxguTwBZzdMSH8vgqYIm8AYrcClRkga6tdanVFlQsqdmh0voyV+nz8GnLIwjaTQpHNLeT2T8Scfv6MAw0fMSBU2Q9PKu46lwsbvXbUemPyARnhZeByO4aDkBgqc2BcoYf7ow0PZWGwReN6At9ZLC65bNT1fyqMzPo6Blb8JtvxK5cDAhZKaLXrgQKNNxZcRKvZeL+U2RMJu4FRj4GprKQD+TXyCeEQb2CmUmss1So7b7clUXWuepJRbYxlpdzVWjZmEOu5j+l85UbYz70OH/38oirp0it8YVx2XIxnKOvWXFwIjyaAh7hEYiSc11oRHyo//akDoNNUWSGYD2isTjvFT7uEXW9e0M9i31VFeBji8EFY/69gSwALgf2qZIwN02DvChnQYGmkIVlEkTf2YN3He4eT/N9okujB X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3128 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: AM5EUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: c5f2db33-042c-4fb2-a4d5-08d79d99e7a8 X-Microsoft-Antispam-Message-Info: vCo+O9uTxs7pajYYv5+60o4+i9INcGloQJ/IlhPdvYoTB4YKgHuxbnU7+11RUxNsMjkDtN3ua1JZav5H6rVlWT0E+oWzpAgxo+gk8Sj/huxCbxcqFK5gmRE9UiC+PfOsOcoVQmLO7h2fZUzToMy+G0rqFEasKetWfEzfKaBTxpSCHp8RHnCjpHQSzyXeToZ+IiTHhDeDk8xtKQNJXUOl9VqxGcSsPafcSHhffDJfRoywJjaDgd/CqIcpE55rXElDiQWBGL96ws/dsp9gZ1bkApjS1af7VDD0CkW1OXFrO4y1f9+1zaVl9G8o25D2hsfjbwFT6CK7m6w/wrEDoawmePx1o6R9vu0my775OpMtymzaPhMmGmyqoN9JRBNN7ZjiQa0riPzuekbgD0nDcuiab87oXItlcbXAjDAC5j3sGSBfjHeRLSARpjsCzBFk32jj X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2020 11:14:31.4986 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6aebd011-5e6b-462b-2c6a-08d79d99ec43 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: VI1PR0801MB1792 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: e9V0I4tVpuYyRiuoTNFa7FWLx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1579518874; bh=WUsL6qraBquBydKFb8O+koZyzOBhIWev+rl49zzCMg8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=KbWgEVEsBnnCXrqJ+JfUWOXCfwJSfXBdRrE90D7ZDcJ5cN5gBfRWaUAyVzdVDJKPXe2 64xOMy6JVBE+1v67+tmX4wU0pvBh/F/0hhWm6T5vJ2W9xFnygKlSDINDCfyHX2g+vtkOS i9oKByMukJkMiRvZl/q6Vi+hiHSDWNn8ub0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Check if SratRAType and SratRALength 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/Srat/SratParser.c | 1= 3 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/Srat= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratPa= rser.c index 6fe7bf681132df08133e3e03e3ee3f020d905dd2..3613900ae322483fdd3d3383de4= e22ba75b2128b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -399,6 +399,19 @@ ParseAcpiSrat ( PARSER_PARAMS (SratResourceAllocationParser) ); =20 + // Check if the values used to control the parsing logic have been + // successfully read. + if ((SratRAType =3D=3D NULL) || + (SratRALength =3D=3D NULL)) { + IncrementErrorCount (); + Print ( + L"ERROR: Insufficient remaining table buffer length to read the " \ + L"Static Resource Allocation structure header. Length =3D %d.\n", + AcpiTableLength - Offset + ); + return; + } + // Make sure the SRAT structure lies inside the table if ((Offset + *SratRALength) > 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 (#53411): https://edk2.groups.io/g/devel/message/53411 Mute This Topic: https://groups.io/mt/69929575/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-