diff options
author | Krzysztof Koch <krzysztof.koch@arm.com> | 2020-01-20 19:13:44 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-02-11 02:12:45 +0000 |
commit | a4826c8664f98a40fc7384107639971a93598fb3 (patch) | |
tree | 9f77342baf76bfb56aaf1bedd9f5774c3cff6600 /ShellPkg | |
parent | 54d33a53145bcf82622ea5a784ac2af99de06d55 (diff) | |
download | edk2-a4826c8664f98a40fc7384107639971a93598fb3.zip edk2-a4826c8664f98a40fc7384107639971a93598fb3.tar.gz edk2-a4826c8664f98a40fc7384107639971a93598fb3.tar.bz2 |
ShellPkg: acpiview: SLIT: Validate global pointer before use
Check if SlitSystemLocalityCount pointer has been successfully updated
before it is used for further table parsing.
Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
Diffstat (limited to 'ShellPkg')
-rw-r--r-- | ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c index ca2808d..17e2166 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c @@ -1,7 +1,7 @@ /** @file
SLIT table parser
- Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -75,9 +75,21 @@ ParseAcpiSlit ( AcpiTableLength,
PARSER_PARAMS (SlitParser)
);
- LocalityPtr = Ptr + Offset;
+ // Check if the values used to control the parsing logic have been
+ // successfully read.
+ if (SlitSystemLocalityCount == NULL) {
+ IncrementErrorCount ();
+ Print (
+ L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
+ AcpiTableLength
+ );
+ return;
+ }
+
+ LocalityPtr = Ptr + Offset;
LocalityCount = *SlitSystemLocalityCount;
+
// We only print the Localities if the count is less than 16
// If the locality count is more than 16 then refer to the
// raw data dump.
|