diff options
author | Alan Modra <amodra@gmail.com> | 2023-06-03 17:16:04 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-06-03 17:17:57 +0930 |
commit | 89c70cd358b8fa46b84cd100efc95495ff0160ae (patch) | |
tree | 2c72223f7b5005d820754c6303fb4de402131515 | |
parent | c6e6e3ab2b70458d34c4a7a2e7e1637d38d49e8f (diff) | |
download | gdb-89c70cd358b8fa46b84cd100efc95495ff0160ae.zip gdb-89c70cd358b8fa46b84cd100efc95495ff0160ae.tar.gz gdb-89c70cd358b8fa46b84cd100efc95495ff0160ae.tar.bz2 |
Re: loongarch readelf support
Another segfault.
* readelf.c (target_specific_reloc_handling): Sanity check
loongarch reloc r_offset.
-rw-r--r-- | binutils/readelf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c index 042d230..23d3e21 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -14021,8 +14021,9 @@ target_specific_reloc_handling (Filedata *filedata, unsigned int reloc_size = 0; int leb_ret = 0; - value = read_leb128 (start + reloc->r_offset, end, false, - &reloc_size, &leb_ret); + if (reloc->r_offset < (size_t) (end - start)) + value = read_leb128 (start + reloc->r_offset, end, false, + &reloc_size, &leb_ret); if (leb_ret != 0 || reloc_size == 0 || reloc_size > 8) error (_("LoongArch ULEB128 field at 0x%lx contains invalid " "ULEB128 value\n"), |