From 4fbc953dbfbff86bebee9fe0a112b561cef58f6a Mon Sep 17 00:00:00 2001 From: eastb233 Date: Thu, 31 Aug 2023 10:16:34 +0800 Subject: [PATCH] [CVE] fix CVE-2023-1972 --- backport-CVE-2023-1972.patch | 35 +++++++++++++++++++++++++++++++++++ binutils.spec | 7 ++++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 backport-CVE-2023-1972.patch diff --git a/backport-CVE-2023-1972.patch b/backport-CVE-2023-1972.patch new file mode 100644 index 0000000..275f5a1 --- /dev/null +++ b/backport-CVE-2023-1972.patch @@ -0,0 +1,35 @@ +From: Nick Clifton +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; diff --git a/binutils.spec b/binutils.spec index 0b66237..6a7ec2c 100644 --- a/binutils.spec +++ b/binutils.spec @@ -2,7 +2,7 @@ Summary: A GNU collection of binary utilities Name: binutils%{?_with_debug:-debug} Version: 2.40 -Release: 3 +Release: 4 License: GPL-3.0-or-later URL: https://sourceware.org/binutils @@ -282,6 +282,8 @@ Patch22: binutils-gold-empty-dwp.patch #### Other patches Patch23: 0001-X86-Change-fpic-to-fPIC-in-PICFLAG.patch +Patch24: backport-CVE-2023-1972.patch + #---------------------------------------------------------------------------- @@ -1315,6 +1317,9 @@ exit 0 #---------------------------------------------------------------------------- %changelog +* Thu Aug 31 2023 eastb233 - 2.40-4 +- fix CVE-2023-1972 + * Tue Aug 29 2023 eastb233 - 2.40-3 - Rename ctf-spec.info in binutils package because gdb-help package also provides it -- Gitee