* Change ridiculous section size error
@ 2021-10-07 3:48 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2021-10-07 3:48 UTC (permalink / raw)
To: binutils
Rather than reporting "memory exhausted", report "file truncated".
You can hit this error on small fuzzed object files, or on files that
are actually truncated. In either case sizes can be such that an out
of memory error is a little confusing.
* compress.c (bfd_get_full_section_contents): Set
bfd_error_file_truncated rather than bfd_error_no_memory when
section size exceeds file size.
diff --git a/bfd/compress.c b/bfd/compress.c
index 6d98aec2d45..4a2ada3e3eb 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -264,7 +264,7 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
{
/* PR 24708: Avoid attempts to allocate a ridiculous amount
of memory. */
- bfd_set_error (bfd_error_no_memory);
+ bfd_set_error (bfd_error_file_truncated);
_bfd_error_handler
/* xgettext:c-format */
(_("error: %pB(%pA) section size (%#" PRIx64 " bytes) is larger than file size (%#" PRIx64 " bytes)"),
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-07 3:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 3:48 Change ridiculous section size error 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).