aboutsummaryrefslogtreecommitdiff
path: root/bfd/compress.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-10-07 11:14:03 +1030
committerAlan Modra <amodra@gmail.com>2021-10-07 14:23:14 +1030
commit89e62f74546ebcbece1dd79993c45bdb7d236b2e (patch)
tree4d6712c7462cb81cc9435245bde3b656b82bc993 /bfd/compress.c
parentc0ae8ccdba58cb781fa953bfa286b5dcbb856b2b (diff)
downloadbinutils-89e62f74546ebcbece1dd79993c45bdb7d236b2e.zip
binutils-89e62f74546ebcbece1dd79993c45bdb7d236b2e.tar.gz
binutils-89e62f74546ebcbece1dd79993c45bdb7d236b2e.tar.bz2
Change ridiculous section size error
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.
Diffstat (limited to 'bfd/compress.c')
-rw-r--r--bfd/compress.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/compress.c b/bfd/compress.c
index 6d98aec..4a2ada3 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)"),