diff options
author | Saket Dumbre <97769119+sacdintel@users.noreply.github.com> | 2023-03-22 15:36:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-22 15:36:05 -0700 |
commit | 2073bcb8a132e2ee16e98bbc0c414f32e5d72275 (patch) | |
tree | 1632b392b1fb9a32555e6eb85f94826763f8fe74 /source/components/resources | |
parent | 14213b11435bb1bd8490cf73f5d731b7f3578d8b (diff) | |
parent | 8ea5ada64b48dada42dbd5f0f58a9ce18f882ede (diff) | |
download | acpica-2073bcb8a132e2ee16e98bbc0c414f32e5d72275.tar.gz |
Merge pull request #853 from tamird/ub-member-access-within-misaligned-address-four
Avoid undefined behavior: member access within misaligned address
Diffstat (limited to 'source/components/resources')
-rw-r--r-- | source/components/resources/rslist.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/components/resources/rslist.c b/source/components/resources/rslist.c index bce499170..cb408197e 100644 --- a/source/components/resources/rslist.c +++ b/source/components/resources/rslist.c @@ -209,7 +209,12 @@ AcpiRsConvertAmlToResources ( if (AcpiUtGetResourceType (Aml) == ACPI_RESOURCE_NAME_SERIAL_BUS) { - if (AmlResource->CommonSerialBus.Type > + /* Avoid undefined behavior: member access within misaligned address */ + + AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus; + memcpy(&CommonSerialBus, AmlResource, sizeof(CommonSerialBus)); + + if (CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE) { ConversionTable = NULL; @@ -219,7 +224,7 @@ AcpiRsConvertAmlToResources ( /* This is an I2C, SPI, UART, or CSI2 SerialBus descriptor */ ConversionTable = AcpiGbl_ConvertResourceSerialBusDispatch [ - AmlResource->CommonSerialBus.Type]; + CommonSerialBus.Type]; } } else |