.../Library/DxeAslUpdateLib/DxeAslUpdateLib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
- Add check for the DSDT not existing.
- Fixed logic errors in loop boundary check.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Michael A Kubacki <michael.a.kubacki@intel.com>
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Co-authored-by: John Mathews <john.mathews@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
.../Library/DxeAslUpdateLib/DxeAslUpdateLib.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
index e6ab43db6d..a9611f750f 100644
--- a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
+++ b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
@@ -59,6 +59,7 @@ InitializeAslUpdateLib (
@param[in] Length - length of data to be overwritten
@retval EFI_SUCCESS - The function completed successfully.
+ @retval EFI_NOT_FOUND - Failed to locate AcpiTable.
**/
EFI_STATUS
UpdateNameAslCode (
@@ -99,11 +100,14 @@ UpdateNameAslCode (
/// Point to the beginning of the DSDT table
///
CurrPtr = (UINT8 *) Table;
+ if (CurrPtr == NULL) {
+ return EFI_NOT_FOUND;
+ }
///
/// Loop through the ASL looking for values that we must fix up.
///
- for (DsdtPointer = CurrPtr; DsdtPointer <= (CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
+ for (DsdtPointer = CurrPtr; DsdtPointer < (CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
///
/// Get a pointer to compare for signature
///
--
2.17.1.windows.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#43739): https://edk2.groups.io/g/devel/message/43739
Mute This Topic: https://groups.io/mt/32482901/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Looks good.
Can we assign a local variable for "EndPtr" and use that in the For loop, instead of the expression and keep the implementation cleaner?
EndPtr = CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length;
for (DsdtPointer = CurrPtr; DsdtPointer < EndPtr; DsdtPointer++) {
-----Original Message-----
From: Desimone, Nathaniel L
Sent: Monday, July 15, 2019 1:40 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@intel.com>; Kubacki, Michael A <michael.a.kubacki@intel.com>; Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>
Subject: [edk2-platforms] [PATCH] KabylakeSiliconPkg: Possible out-of-bounds memory writes
- Add check for the DSDT not existing.
- Fixed logic errors in loop boundary check.
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Michael A Kubacki <michael.a.kubacki@intel.com>
Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
Co-authored-by: John Mathews <john.mathews@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
---
.../Library/DxeAslUpdateLib/DxeAslUpdateLib.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
index e6ab43db6d..a9611f750f 100644
--- a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
+++ b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.c
@@ -59,6 +59,7 @@ InitializeAslUpdateLib (
@param[in] Length - length of data to be overwritten
@retval EFI_SUCCESS - The function completed successfully.
+ @retval EFI_NOT_FOUND - Failed to locate AcpiTable.
**/
EFI_STATUS
UpdateNameAslCode (
@@ -99,11 +100,14 @@ UpdateNameAslCode (
/// Point to the beginning of the DSDT table
///
CurrPtr = (UINT8 *) Table;
+ if (CurrPtr == NULL) {
+ return EFI_NOT_FOUND;
+ }
///
/// Loop through the ASL looking for values that we must fix up.
///
- for (DsdtPointer = CurrPtr; DsdtPointer <= (CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
+ for (DsdtPointer = CurrPtr; DsdtPointer < (CurrPtr + ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
///
/// Get a pointer to compare for signature
///
--
2.17.1.windows.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#43750): https://edk2.groups.io/g/devel/message/43750
Mute This Topic: https://groups.io/mt/32482901/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Please extend copyright to 2019, with that change, Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
> -----Original Message-----
> From: Desimone, Nathaniel L
> Sent: Tuesday, July 16, 2019 4:40 AM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Kubacki, Michael A
> <michael.a.kubacki@intel.com>; Chaganty, Rangasai V
> <rangasai.v.chaganty@intel.com>
> Subject: [edk2-platforms] [PATCH] KabylakeSiliconPkg: Possible out-of-bounds
> memory writes
>
> - Add check for the DSDT not existing.
> - Fixed logic errors in loop boundary check.
>
> Cc: Chasel Chiu <chasel.chiu@intel.com>
> Cc: Michael A Kubacki <michael.a.kubacki@intel.com>
> Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
>
> Co-authored-by: John Mathews <john.mathews@intel.com>
> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
> ---
> .../Library/DxeAslUpdateLib/DxeAslUpdateLib.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git
> a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.
> c
> b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.
> c
> index e6ab43db6d..a9611f750f 100644
> ---
> a/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.
> c
> +++
> b/Silicon/Intel/KabylakeSiliconPkg/Library/DxeAslUpdateLib/DxeAslUpdateLib.
> c
> @@ -59,6 +59,7 @@ InitializeAslUpdateLib (
> @param[in] Length - length of data to be overwritten
>
> @retval EFI_SUCCESS - The function completed successfully.
> + @retval EFI_NOT_FOUND - Failed to locate AcpiTable.
> **/
> EFI_STATUS
> UpdateNameAslCode (
> @@ -99,11 +100,14 @@ UpdateNameAslCode (
> /// Point to the beginning of the DSDT table
> ///
> CurrPtr = (UINT8 *) Table;
> + if (CurrPtr == NULL) {
> + return EFI_NOT_FOUND;
> + }
>
> ///
> /// Loop through the ASL looking for values that we must fix up.
> ///
> - for (DsdtPointer = CurrPtr; DsdtPointer <= (CurrPtr +
> ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
> + for (DsdtPointer = CurrPtr; DsdtPointer < (CurrPtr +
> ((EFI_ACPI_COMMON_HEADER *) CurrPtr)->Length); DsdtPointer++) {
> ///
> /// Get a pointer to compare for signature
> ///
> --
> 2.17.1.windows.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#43751): https://edk2.groups.io/g/devel/message/43751
Mute This Topic: https://groups.io/mt/32482901/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.