|
| 1 | +From 35b1514eba18a239c85867ab4132408d85e1e120 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Azure Linux Security Servicing Account |
| 3 | + |
| 4 | +Date: Thu, 17 Jul 2025 08:48:22 +0000 |
| 5 | +Subject: [PATCH] Fix CVE CVE-2025-7546 in binutils |
| 6 | + |
| 7 | +Upstream Patch Reference: https://github.com/bminor/binutils-gdb/commit/41461010eb7c79fee7a9d5f6209accdaac66cc6b.patch |
| 8 | +--- |
| 9 | + bfd/elf.c | 23 ++++++++++------------- |
| 10 | + 1 file changed, 10 insertions(+), 13 deletions(-) |
| 11 | + |
| 12 | +diff --git a/bfd/elf.c b/bfd/elf.c |
| 13 | +index d38e0aff..1de0cec0 100644 |
| 14 | +--- a/bfd/elf.c |
| 15 | ++++ b/bfd/elf.c |
| 16 | +@@ -4120,20 +4120,17 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg) |
| 17 | + break; |
| 18 | + } |
| 19 | + |
| 20 | +- /* We should always get here with loc == sec->contents + 4, but it is |
| 21 | +- possible to craft bogus SHT_GROUP sections that will cause segfaults |
| 22 | +- in objcopy without checking loc here and in the loop above. */ |
| 23 | +- if (loc == sec->contents) |
| 24 | +- BFD_ASSERT (0); |
| 25 | +- else |
| 26 | ++ /* We should always get here with loc == sec->contents + 4. Return |
| 27 | ++ an error for bogus SHT_GROUP sections. */ |
| 28 | ++ loc -= 4; |
| 29 | ++ if (loc != sec->contents) |
| 30 | + { |
| 31 | +- loc -= 4; |
| 32 | +- if (loc != sec->contents) |
| 33 | +- { |
| 34 | +- BFD_ASSERT (0); |
| 35 | +- memset (sec->contents + 4, 0, loc - sec->contents); |
| 36 | +- loc = sec->contents; |
| 37 | +- } |
| 38 | ++ /* xgettext:c-format */ |
| 39 | ++ _bfd_error_handler (_("%pB: corrupted group section: `%pA'"), |
| 40 | ++ abfd, sec); |
| 41 | ++ bfd_set_error (bfd_error_bad_value); |
| 42 | ++ *failedptr = true; |
| 43 | ++ return; |
| 44 | + } |
| 45 | + |
| 46 | + H_PUT_32 (abfd, sec->flags & SEC_LINK_ONCE ? GRP_COMDAT : 0, loc); |
| 47 | +-- |
| 48 | +2.45.3 |
| 49 | + |
0 commit comments