]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
binutils: Fix CVE-2025-7545
authorDeepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
Thu, 24 Jul 2025 10:31:53 +0000 (03:31 -0700)
committerSteve Sakoman <steve@sakoman.com>
Fri, 25 Jul 2025 13:13:34 +0000 (06:13 -0700)
objcopy: Don't extend the output section size
Since the output section contents are copied from the input, don't
extend the output section size beyond the input section size.

Backport a patch from upstream to fix CVE-2025-7545
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=08c3cbe5926e4d355b5cb70bbec2b1eeb40c2944]

Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/recipes-devtools/binutils/binutils-2.42.inc
meta/recipes-devtools/binutils/binutils/0023-CVE-2025-7545.patch [new file with mode: 0644]

index a3ad655dbe0312bd1d59515610f2d195b96a67c3..fb34ea9763e79a5b98b92a0f8f05e34bfaa58e90 100644 (file)
@@ -54,5 +54,6 @@ SRC_URI = "\
      file://0022-CVE-2025-5245.patch \
      file://0022-CVE-2025-5244.patch \
      file://0023-CVE-2025-7546.patch \
+     file://0023-CVE-2025-7545.patch \
 "
 S  = "${WORKDIR}/git"
diff --git a/meta/recipes-devtools/binutils/binutils/0023-CVE-2025-7545.patch b/meta/recipes-devtools/binutils/binutils/0023-CVE-2025-7545.patch
new file mode 100644 (file)
index 0000000..de132f7
--- /dev/null
@@ -0,0 +1,39 @@
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Sat, 21 Jun 2025 06:36:56 +0800
+
+Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h08c3cbe5926e4d355b5cb70bbec2b1eeb40c2944]
+CVE: CVE-2025-7545
+
+Since the output section contents are copied from the input, don't
+extend the output section size beyond the input section size.
+
+       PR binutils/33049
+       * objcopy.c (copy_section): Don't extend the output section
+       size beyond the input section size.
+
+Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
+
+diff --git a/binutils/objcopy.c b/binutils/objcopy.c
+index a85d2620..18cd1bfd 100644
+--- a/binutils/objcopy.c
++++ b/binutils/objcopy.c
+@@ -4547,6 +4547,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
+         char *to = (char *) memhunk;
+         char *end = (char *) memhunk + size;
+         int i;
++        bfd_size_type memhunk_size = size;
+         /* If the section address is not exactly divisible by the interleave,
+            then we must bias the from address.  If the copy_byte is less than
+@@ -4566,6 +4567,11 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
+             }
+         size = (size + interleave - 1 - copy_byte) / interleave * copy_width;
++
++         /* Don't extend the output section size.  */
++         if (size > memhunk_size)
++           size = memhunk_size;
++        
+         osection->lma /= interleave;
+         if (copy_byte < extra)
+           osection->lma++;