* segfault in objdump.c reloc_at
@ 2022-10-26 6:51 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-10-26 6:51 UTC (permalink / raw)
To: binutils
bfd_canonicalize_reloc returns -1L on errors.
* objdump.c (load_specific_debug_section): Properly handle
error return from bfd_canonicalize_reloc.
diff --git a/binutils/objdump.c b/binutils/objdump.c
index a4ab0dbd66c..0825e051ef6 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -4212,13 +4212,13 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
if (reloc_size > 0)
{
- unsigned long reloc_count;
+ long reloc_count;
arelent **relocs;
relocs = (arelent **) xmalloc (reloc_size);
reloc_count = bfd_canonicalize_reloc (abfd, sec, relocs, NULL);
- if (reloc_count == 0)
+ if (reloc_count <= 0)
free (relocs);
else
{
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-26 6:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-26 6:51 segfault in objdump.c reloc_at 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).