aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-01-04 23:00:12 +1030
committerAlan Modra <amodra@gmail.com>2023-01-04 23:52:26 +1030
commitfa19218f8b4ec6bc2d7da6b20dce5f2cd22072bd (patch)
tree8e7bd5c56240b9bf4cea27ebed1701b44ec40b5a
parent3bba9d93294a8172018731477df72c1c3ef42136 (diff)
downloadgdb-fa19218f8b4ec6bc2d7da6b20dce5f2cd22072bd.zip
gdb-fa19218f8b4ec6bc2d7da6b20dce5f2cd22072bd.tar.gz
gdb-fa19218f8b4ec6bc2d7da6b20dce5f2cd22072bd.tar.bz2
objcopy fuzzed pe out of memory
This occurs when attempting to read back a section from the output file in _bfd_XX_bfd_copy_private_bfd_data_common. The copy of the section failed size sanity checking, thus it won't be written. * objcopy.c (copy_object): Return false if copy_section or copy_relocations_in_section fails.
-rw-r--r--binutils/objcopy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 4d88890..80a5d52 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3328,9 +3328,13 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
/* This has to happen before section positions are set. */
bfd_map_over_sections (ibfd, copy_relocations_in_section, obfd);
+ if (status != 0)
+ return false;
/* This has to happen after the symbol table has been set. */
bfd_map_over_sections (ibfd, copy_section, obfd);
+ if (status != 0)
+ return false;
if (add_sections != NULL)
{