* [binutils-gdb] Re: loongarch readelf support
@ 2023-06-03 8:06 Alan Modra
0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2023-06-03 8:06 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=89c70cd358b8fa46b84cd100efc95495ff0160ae
commit 89c70cd358b8fa46b84cd100efc95495ff0160ae
Author: Alan Modra <amodra@gmail.com>
Date: Sat Jun 3 17:16:04 2023 +0930
Re: loongarch readelf support
Another segfault.
* readelf.c (target_specific_reloc_handling): Sanity check
loongarch reloc r_offset.
Diff:
---
binutils/readelf.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 042d2301517..23d3e21bea6 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"),
^ permalink raw reply [flat|nested] 2+ messages in thread
* [binutils-gdb] Re: loongarch readelf support
@ 2023-06-06 10:43 Alan Modra
0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2023-06-06 10:43 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d3f340763bab7c74838ebb481fd7ff93acd9f00c
commit d3f340763bab7c74838ebb481fd7ff93acd9f00c
Author: Alan Modra <amodra@gmail.com>
Date: Tue Jun 6 19:56:56 2023 +0930
Re: loongarch readelf support
Commit 89c70cd358b8 apparently results in a bogus "value may be used
uninitialized" warning with some combination of compiler and
optimisation options.
* readelf.c (target_specific_reloc_handling): Init value.
Diff:
---
binutils/readelf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 23d3e21bea6..c3e5c587afe 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -14017,7 +14017,7 @@ target_specific_reloc_handling (Filedata *filedata,
case 107: /* R_LARCH_ADD_ULEB128. */
case 108: /* R_LARCH_SUB_ULEB128. */
{
- uint64_t value;
+ uint64_t value = 0;
unsigned int reloc_size = 0;
int leb_ret = 0;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-06 10:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-03 8:06 [binutils-gdb] Re: loongarch readelf support Alan Modra
2023-06-06 10:43 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).