public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] unstrip: Always check gelf_getrel[a] results
@ 2021-06-18 13:08 Mark Wielaard
  2021-07-02 22:38 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2021-06-18 13:08 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] unstrip: Always check gelf_getrel[a] results
  2021-06-18 13:08 [PATCH] unstrip: Always check gelf_getrel[a] results Mark Wielaard
@ 2021-07-02 22:38 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2021-07-02 22:38 UTC (permalink / raw)
  To: elfutils-devel

On Fri, Jun 18, 2021 at 03:08:48PM +0200, Mark Wielaard wrote:
> +2021-06-18  Mark Wielaard  <mark@klomp.org>
> +
> +	* unstrip.c (adjust_relocs): Check gelf_getrel and geld_getrela.
> +

Pushed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-02 22:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18 13:08 [PATCH] unstrip: Always check gelf_getrel[a] results Mark Wielaard
2021-07-02 22:38 ` Mark Wielaard

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).