ShellPkg: acpiview: RSDP: Validate global pointer before use

Check if XsdtAddress pointer has been successfully updated before it
is used for further table parsing.

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
This commit is contained in:
Krzysztof Koch 2020-01-20 19:13:42 +08:00 committed by mergify[bot]
parent 5bd326c5f3
commit f69248d093
1 changed files with 12 additions and 0 deletions

View File

@ -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.