From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] unstrip: Always check gelf_getrel[a] results
Date: Fri, 18 Jun 2021 15:08:48 +0200 [thread overview]
Message-ID: <20210618130848.24609-1-mark@klomp.org> (raw)
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
src/ChangeLog | 4 ++++
src/unstrip.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/src/ChangeLog b/src/ChangeLog
index 9d4ce31d..71599e5d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-18 Mark Wielaard <mark@klomp.org>
+
+ * unstrip.c (adjust_relocs): Check gelf_getrel and geld_getrela.
+
2021-06-18 Mark Wielaard <mark@klomp.org>
* strip.c (remove_debug_relocations): Check gelf_update results.
diff --git a/src/unstrip.c b/src/unstrip.c
index e488e810..6618ec9b 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -462,6 +462,7 @@ adjust_relocs (Elf_Scn *outscn, Elf_Scn *inscn, const GElf_Shdr *shdr,
{
GElf_Rel rel_mem;
GElf_Rel *rel = gelf_getrel (data, i, &rel_mem);
+ ELF_CHECK (rel != NULL, _("gelf_getrel failed: %s"));
adjust_reloc (&rel->r_info, map, map_size);
ELF_CHECK (gelf_update_rel (data, i, rel),
_("cannot update relocation: %s"));
@@ -476,6 +477,7 @@ adjust_relocs (Elf_Scn *outscn, Elf_Scn *inscn, const GElf_Shdr *shdr,
{
GElf_Rela rela_mem;
GElf_Rela *rela = gelf_getrela (data, i, &rela_mem);
+ ELF_CHECK (rela != NULL, _("gelf_getrela failed: %s"));
adjust_reloc (&rela->r_info, map, map_size);
ELF_CHECK (gelf_update_rela (data, i, rela),
_("cannot update relocation: %s"));
--
2.18.4
next reply other threads:[~2021-06-18 13:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-18 13:08 Mark Wielaard [this message]
2021-07-02 22:38 ` Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210618130848.24609-1-mark@klomp.org \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).