From 2816ff0ab0d6505bf580aa8eec02cc2b89f04230 Mon Sep 17 00:00:00 2001 From: Simon Wang Date: Sat, 23 May 2026 12:56:57 +0800 Subject: [PATCH] ShellPkg/Acpiview: Refactor EINJ table parser validation ACPI defines Injection Header Size as the length of the EINJ injection header, not necessarily the absolute offset of the instruction entries. Update parser validation to use the correct entry offset calculation and accept the layout used by Linux and existing firmware tables. Signed-off-by: Simon Wang --- .../UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c index d01b15ff5f..5e5dc08fbc 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c @@ -327,7 +327,9 @@ ParseAcpiEinj ( ); // Validate Error Source Descriptors Count. - if ((mEinjInjectionHdrSize == NULL) || (*mEinjInjectionHdrSize != Offset)) { + if ((mEinjInjectionHdrSize == NULL) || + (*mEinjInjectionHdrSize != (Offset - sizeof (EFI_ACPI_DESCRIPTION_HEADER)))) + { IncrementErrorCount (); Print (L"ERROR: Invalid Injection Header...\n"); return;