[PATCH 03/10] elflint: Explicitly check and ignore elf_compress error.

Mark Wielaard mark@klomp.org
Tue Jun 16 22:25:32 GMT 2020


We just want to make sure that any section data is decompressed before
use, if the section was already decompressed that is fine, so just ignore
any errors. The make this more clear, explicitly check for errors, then
don't do anything. This is better than silently ignoring since everywhere
else in the code we do explicitly check for errors.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 src/ChangeLog | 5 +++++
 src/elflint.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 512d7b54..e78bc358 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2020-06-16  Mark Wielaard  <mark@klomp.org>
+
+	* elflint.c (check_elf_header): Explicitly check and ignore
+	any error from elf_compress.
+
 2020-06-07  Mark Wielaard  <mark@klomp.org>
 
 	* nm.c (sort_by_name_strtab): Replace by...
diff --git a/src/elflint.c b/src/elflint.c
index 72584de0..9cdcccca 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -467,7 +467,7 @@ invalid number of section header table entries\n"));
 	  break;
 	/* If the section wasn't compressed this does nothing, but
 	   returns an error.  We don't care.  */
-	elf_compress (scn, 0, 0);
+	if (elf_compress (scn, 0, 0) < 0) { ; }
      }
   if (scnt < shnum)
     ERROR (gettext ("Can only check %u headers, shnum was %u\n"), scnt, shnum);
-- 
2.18.4



More information about the Elfutils-devel mailing list