public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* fuzzed file timeout
@ 2023-01-04 13:26 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-01-04 13:26 UTC (permalink / raw)
  To: binutils

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.

diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index a6182b48b6c..4d888906e67 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -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.  */

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-04 13:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-04 13:26 fuzzed file timeout Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).