summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2023-06-05 17:24:13 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-06-06 07:41:03 +0100
commit10d63933e3a30bfac2f6cec896460c22e04baadd (patch)
treeabaf163bc7258a126facf658c0dcf8df8ed66cf5
parent469c28924ab9debe810e3277b27ad936781e7ce5 (diff)
downloadopenembedded-core-contrib-10d63933e3a30bfac2f6cec896460c22e04baadd.tar.gz
binutils: fix CVE-2023-1972
Backport a patch from upstream to fix CVE-2023-1972. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/binutils/binutils-2.40.inc1
-rw-r--r--meta/recipes-devtools/binutils/binutils/0001-Fix-an-illegal-memory-access-when-an-accessing-a-zer.patch43
2 files changed, 44 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.40.inc b/meta/recipes-devtools/binutils/binutils-2.40.inc
index 84dbf5f730..dea68ee6fc 100644
--- a/meta/recipes-devtools/binutils/binutils-2.40.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.40.inc
@@ -35,5 +35,6 @@ SRC_URI = "\
file://0015-Remove-duplicate-pe-dll.o-entry-deom-targ_extra_ofil.patch \
file://0016-CVE-2023-25586.patch \
file://fix-time64.patch \
+ file://0001-Fix-an-illegal-memory-access-when-an-accessing-a-zer.patch \
"
S = "${WORKDIR}/git"
diff --git a/meta/recipes-devtools/binutils/binutils/0001-Fix-an-illegal-memory-access-when-an-accessing-a-zer.patch b/meta/recipes-devtools/binutils/binutils/0001-Fix-an-illegal-memory-access-when-an-accessing-a-zer.patch
new file mode 100644
index 0000000000..31157cacd2
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/0001-Fix-an-illegal-memory-access-when-an-accessing-a-zer.patch
@@ -0,0 +1,43 @@
+From c22d38baefc5a7a1e1f5cdc9dbb556b1f0ec5c57 Mon Sep 17 00:00:00 2001
+From: Nick Clifton <nickc@redhat.com>
+Date: Thu, 30 Mar 2023 10:10:09 +0100
+Subject: [PATCH] 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.
+
+CVE: CVE-2023-1972
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ bfd/ChangeLog | 6 ++++++
+ bfd/elf.c | 5 +++++
+ 2 files changed, 11 insertions(+)
+
+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;
+--
+2.34.1
+