projects
/
binutils-gdb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c6e6e3a
)
Re: loongarch readelf support
author
Alan Modra
<amodra@gmail.com>
Sat, 3 Jun 2023 07:46:04 +0000
(17:16 +0930)
committer
Alan Modra
<amodra@gmail.com>
Sat, 3 Jun 2023 07:47:57 +0000
(17:17 +0930)
Another segfault.
* readelf.c (target_specific_reloc_handling): Sanity check
loongarch reloc r_offset.
binutils/readelf.c
patch
|
blob
|
history
diff --git
a/binutils/readelf.c
b/binutils/readelf.c
index 042d2301517aab2f2c544ad866f6cca959e59ff0..23d3e21bea68f005d74e02c190856b831d98d0c6 100644
(file)
--- 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"),