diff options
| author | Alan Modra <amodra@gmail.com> | 2026-03-22 13:11:39 +1030 |
|---|---|---|
| committer | Alan Modra <amodra@gmail.com> | 2026-03-22 15:09:56 +1030 |
| commit | efc26507d9998eef6dc0b17480e0d921f40958c1 (patch) | |
| tree | 40cf8cd52cd7815cbc0c31d2305a601eb06c574e /opcodes | |
| parent | 5b7aeeebbcbd0307451acefd7528a37bf933d936 (diff) | |
| download | fsf-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.c | 12 |
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; } |
