summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2021-06-18 15:08:48 +0200
committerMark Wielaard <mark@klomp.org>2021-07-03 00:25:29 +0200
commite32782a4fe314ff0cf96039d1142706a1d701587 (patch)
tree662674d064f118970206de4a3a7b412b3f2037a0
parentd3671293d7b86810a4a02de18ebea6d19ca82623 (diff)
downloadelfutils-e32782a4fe314ff0cf96039d1142706a1d701587.tar.gz
unstrip: Always check gelf_getrel[a] results
Signed-off-by: Mark Wielaard <mark@klomp.org>
-rw-r--r--src/ChangeLog4
-rw-r--r--src/unstrip.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9d4ce31d..71599e5d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
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.
(update_section_size): Likewise.
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"));