edk2/EmbeddedPkg/Library/AcpiLib
Johnny.Fan 2970e5699b EmbeddedPkg/AcpiLib: Fix memory corruption in AcpiAmlObjectUpdateInteger
The original implementation of AcpiAmlObjectUpdateInteger had a critical
  bug when updating integer objects that were encoded with AML_ZERO_OP(0x00)
  or AML_ONE_OP(0x01), which are 1-byte optimized encodings.

  When the caller tried to update such an object to a value other than 0
  or 1, the code would:
  1. Overwrite the opcode byte with the new value's LSB
  2. This changed the opcode itself, e.g. 0x0B becomes AML_WORD_PREFIX
  3. Subsequent AML bytes (name segments of following objects) get
     misinterpreted as integer data
  4. Result: silent AML structure is silently corrupted, causing the OS to
     fail parsing ACPI tables and eventually crash.

  The fix:
  1. Only allow 0 -> 0 or 1 updates using the original 1-byte encoding
  2. For any other value, explicitly fail with a diagnostic
  3. Provide clear debug instructions on how to fix the ASL source

Reviewed-by: jie.fu <jie.fu@cixtech.com>
Signed-off-by: Johnny.Fan <Johnny.Fan@cixtech.com>
2026-08-12 08:13:56 +00:00
..
AcpiLib.c EmbeddedPkg/AcpiLib: Fix memory corruption in AcpiAmlObjectUpdateInteger 2026-08-12 08:13:56 +00:00
AcpiLib.inf EmbeddedPkg/AcpiLib: Add more helper functions 2021-12-17 15:53:06 +00:00