aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2026-03-22 13:11:39 +1030
committerAlan Modra <amodra@gmail.com>2026-03-22 15:09:56 +1030
commitefc26507d9998eef6dc0b17480e0d921f40958c1 (patch)
tree40cf8cd52cd7815cbc0c31d2305a601eb06c574e /opcodes
parent5b7aeeebbcbd0307451acefd7528a37bf933d936 (diff)
downloadfsf-binutils-gdb-efc26507d9998eef6dc0b17480e0d921f40958c1.tar.gz
fsf-binutils-gdb-efc26507d9998eef6dc0b17480e0d921f40958c1.tar.bz2
fsf-binutils-gdb-efc26507d9998eef6dc0b17480e0d921f40958c1.zip
null dereference in csky opcodes support
section->relocation will remain NULL on an error reading the relocs. * csky-dis.c (is_extern_symbol): Delete section flag check. Instead check that section->relocation is non-NULL. Make addr param a bfd_vma.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/csky-dis.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/opcodes/csky-dis.c b/opcodes/csky-dis.c
index aaf6ffd1b85..6c905833cce 100644
--- a/opcodes/csky-dis.c
+++ b/opcodes/csky-dis.c
@@ -201,19 +201,15 @@ csky_find_inst_info (struct csky_opcode_info const **pinfo,
}
static bool
-is_extern_symbol (struct disassemble_info *info, int addr)
+is_extern_symbol (struct disassemble_info *info, bfd_vma addr)
{
- unsigned int rel_count = 0;
-
- if (info->section == NULL)
- return 0;
- if ((info->section->flags & SEC_RELOC) != 0) /* Fit .o file. */
+ if (info->section != NULL && info->section->relocation != NULL)
{
+ unsigned int rel_count = 0;
struct reloc_cache_entry *pt = info->section->relocation;
for (; rel_count < info->section->reloc_count; rel_count++, pt++)
- if ((long unsigned int)addr == pt->address)
+ if (addr == pt->address)
return true;
- return false;
}
return false;
}