fix CVE-2023-1972

(cherry picked from commit 8b82463e7058429f9202f43bdf6db1ac22da58e6)
This commit is contained in:
eastb233 2023-08-30 16:59:51 +08:00 committed by openeuler-sync-bot
parent 13cc144193
commit 8295726d4a
2 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From: Nick Clifton <nickc@redhat.com>
Date: Thu, 30 Mar 2023 09:10:09 +0000 (+0100)
Subject: Fix an illegal memory access when an accessing a zer0-lengthverdef table.
X-Git-Tag: binutils-2_41~1100
X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=c22d38baefc5a7a1e1f5cdc9dbb556b1f0ec5c57
Fix an illegal memory access when an accessing a zer0-lengthverdef table.
PR 30285
* elf.c (_bfd_elf_slurp_version_tables): Fail if no version definitions are allocated.
---
diff --git a/bfd/elf.c b/bfd/elf.c
index 027d0143735..185028cbd97 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9030,6 +9030,9 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
bfd_set_error (bfd_error_file_too_big);
goto error_return_verdef;
}
+
+ if (amt == 0)
+ goto error_return_verdef;
elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt);
if (elf_tdata (abfd)->verdef == NULL)
goto error_return_verdef;
@@ -9133,6 +9136,8 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
bfd_set_error (bfd_error_file_too_big);
goto error_return;
}
+ if (amt == 0)
+ goto error_return;
elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt);
if (elf_tdata (abfd)->verdef == NULL)
goto error_return;

View File

@ -1,7 +1,7 @@
Summary: Binary utilities
Name: binutils
Version: 2.37
Release: 19
Release: 20
License: GPLv3+
URL: https://sourceware.org/binutils
@ -77,6 +77,7 @@ Patch51: CVE-2022-47008.patch
Patch52: backport-CVE-2022-47011.patch
Patch53: backport-CVE-2022-47696.patch
Patch54: backport-CVE-2021-46174.patch
Patch55: backport-CVE-2023-1972.patch
Provides: bundled(libiberty)
@ -400,6 +401,9 @@ fi
%{_infodir}/bfd*info*
%changelog
* Wed Aug 30 2023 eastb233 <xiezhiheng@huawei.com> - 2.37-20
- fix CVE-2023-1972
* Tue Aug 29 2023 liningjie <liningjie@xfusion.com> - 2.37-19
- fix CVE-2021-46174