diff --git a/0089-MdePkg-Fix-overflow-issue-in-BasePeCoffLib.patch b/0089-MdePkg-Fix-overflow-issue-in-BasePeCoffLib.patch new file mode 100644 index 0000000000000000000000000000000000000000..82620e66a208e4ad58eedbedcad8a2231645abe7 --- /dev/null +++ b/0089-MdePkg-Fix-overflow-issue-in-BasePeCoffLib.patch @@ -0,0 +1,32 @@ +From c95233b8525ca6828921affd1496146cff262e65 Mon Sep 17 00:00:00 2001 +From: Doug Flick +Date: Fri, 27 Sep 2024 12:08:55 -0700 +Subject: [PATCH] MdePkg: Fix overflow issue in BasePeCoffLib + +The RelocDir->Size is a UINT32 value, and RelocDir->VirtualAddress is +also a UINT32 value. The current code does not check for overflow when +adding RelocDir->Size to RelocDir->VirtualAddress. This patch adds a +check to ensure that the addition does not overflow. + +Signed-off-by: Doug Flick +Authored-by: sriraamx gobichettipalayam +--- + MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c +index 1102833..7fa4714 100644 +--- a/MdePkg/Library/BasePeCoffLib/BasePeCoff.c ++++ b/MdePkg/Library/BasePeCoffLib/BasePeCoff.c +@@ -991,7 +991,7 @@ PeCoffLoaderRelocateImage ( + RelocDir = &Hdr.Te->DataDirectory[0]; + } + +- if ((RelocDir != NULL) && (RelocDir->Size > 0)) { ++ if ((RelocDir != NULL) && (RelocDir->Size > 0) && (RelocDir->Size - 1 < MAX_UINT32 - RelocDir->VirtualAddress)) { + RelocBase = (EFI_IMAGE_BASE_RELOCATION *) PeCoffLoaderImageAddress (ImageContext, RelocDir->VirtualAddress, TeStrippedOffset); + RelocBaseEnd = (EFI_IMAGE_BASE_RELOCATION *) PeCoffLoaderImageAddress (ImageContext, + RelocDir->VirtualAddress + RelocDir->Size - 1, +-- +2.43.0 + diff --git a/edk2.spec b/edk2.spec index 30145009cd9dc8d3f2786ca5495d03c1bcf43a8f..7ef39c38d4c8a3237345bbb84592ee7244506c53 100644 --- a/edk2.spec +++ b/edk2.spec @@ -5,7 +5,7 @@ Name: edk2 Version: %{stable_date} -Release: 20 +Release: 21 Summary: EFI Development Kit II License: BSD-2-Clause-Patent URL: https://github.com/tianocore/edk2 @@ -126,6 +126,9 @@ Patch0086: 0086-Fix-NETSCAPE_SPKI_print-function-to-not-assume-NUL-t.patch Patch0087: 0087-Fix-EC_GROUP_new_from_ecparameters-to-check-the-base.patch Patch0088: 0088-Fix-possible-infinite-loop-in-BN_mod_sqrt.patch +# Fix CVE-2024-38796 +patch0089: 0089-MdePkg-Fix-overflow-issue-in-BasePeCoffLib.patch + BuildRequires: acpica-tools gcc gcc-c++ libuuid-devel python3 bc nasm python3-unversioned-command %description @@ -326,6 +329,9 @@ chmod +x %{buildroot}%{_bindir}/Rsa2048Sha256GenerateKeys %endif %changelog +* Wed Oct 09 2024 zhangxianting - 202011-21 +- fix CVE-2024-38796 + * Tue Sep 3 2024 shenyage - 202011-20 - fix CVE-2021-3712、CVE-2022-0778