fuzzed file timeout
authorAlan Modra <amodra@gmail.com>
Wed, 4 Jan 2023 11:16:06 +0000 (21:46 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 4 Jan 2023 13:22:26 +0000 (23:52 +1030)
objcopy of archive, element containing an object with a fuzzed section
size far exceeding the element size.  copy_section detects this, but
the temp file is laid out for the large section.  It can take a long
time to write terabytes of sparse file, a waste of time when it will
be deleted.

* objcopy.c (copy_archive): Don't write element contents after
bad status result from copy_object.

binutils/objcopy.c

index a6182b48b6c0ebc293ef57f306fa71231f3efbfa..4d888906e6784f13a94fcb387a9cceef0c314c0a 100644 (file)
@@ -3686,7 +3686,8 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
       if (!ok_object)
        del = !copy_unknown_object (this_element, output_bfd);
 
-      if (!(ok_object && !del ? bfd_close : bfd_close_all_done) (output_bfd))
+      if (!(ok_object && !del && !status
+           ? bfd_close : bfd_close_all_done) (output_bfd))
        {
          bfd_nonfatal_message (output_name, NULL, NULL, NULL);
          /* Error in new object file. Don't change archive.  */