From 282faaf7985b8063328c0befd4eaf57f21199b1e Mon Sep 17 00:00:00 2001 From: liningjie Date: Tue, 29 Aug 2023 22:53:40 +0800 Subject: [PATCH] fix CVE-2021-46174 (cherry picked from commit a710d1b1bbc482edc50565891127ba887b8bb824) --- backport-CVE-2021-46174.patch | 30 ++++++++++++++++++++++++++++++ binutils.spec | 6 +++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 backport-CVE-2021-46174.patch diff --git a/backport-CVE-2021-46174.patch b/backport-CVE-2021-46174.patch new file mode 100644 index 0000000..74c87b5 --- /dev/null +++ b/backport-CVE-2021-46174.patch @@ -0,0 +1,30 @@ +From cad4d6b91e97b6962807d33c04ed7e7797788438 Mon Sep 17 00:00:00 2001 +From: Alan Modra +Date: Thu, 20 Jan 2022 13:58:38 +1030 +Subject: [PATCH] PR28753, buffer overflow in read_section_stabs_debugging_info + + PR 28753 + * rddbg.c (read_section_stabs_debugging_info): Don't read past + end of section when concatentating stab strings. + +(cherry picked from commit 085b299b71721e15f5c5c5344dc3e4e4536dadba) +--- + binutils/rddbg.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/binutils/rddbg.c b/binutils/rddbg.c +index 42605b83d1a..169c52f4983 100644 +--- a/binutils/rddbg.c ++++ b/binutils/rddbg.c +@@ -210,7 +210,7 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount, + an attempt to read the byte before 'strings' would occur. */ + while ((len = strlen (s)) > 0 + && s[len - 1] == '\\' +- && stab + 12 < stabs + stabsize) ++ && stab + 16 <= stabs + stabsize) + { + char *p; + +-- +2.39.3 + diff --git a/binutils.spec b/binutils.spec index c943f32..e93f0e0 100644 --- a/binutils.spec +++ b/binutils.spec @@ -1,7 +1,7 @@ Summary: Binary utilities Name: binutils Version: 2.37 -Release: 18 +Release: 19 License: GPLv3+ URL: https://sourceware.org/binutils @@ -76,6 +76,7 @@ Patch50: Fix-gold-relocation-offset-and-adrp-signed-shife.patch Patch51: CVE-2022-47008.patch Patch52: backport-CVE-2022-47011.patch Patch53: backport-CVE-2022-47696.patch +Patch54: backport-CVE-2021-46174.patch Provides: bundled(libiberty) @@ -399,6 +400,9 @@ fi %{_infodir}/bfd*info* %changelog +* Tue Aug 29 2023 liningjie - 2.37-19 +- fix CVE-2021-46174 + * Sun Aug 27 2023 liningjie - 2.37-18 - fix CVE-2022-47696 -- Gitee