commit:     33f047637d8bc3c5d3d3faa37a8ad5b3f8825213
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 18 23:37:19 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Mar 18 23:37:19 2020 +0000
URL:        https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=33f04763

scanelf.c: don't srash in -v mode on non-functions

Fix crash when running in verbose mode on bad files:
$ ./scanelf -T -v gdb

The file is taken from bug #713082.

Bug: https://bugs.gentoo.org/713082
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 scanelf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scanelf.c b/scanelf.c
index 440a193..f99aa19 100644
--- a/scanelf.c
+++ b/scanelf.c
@@ -732,7 +732,7 @@ static const char *scanelf_file_textrels(elfobj *elf, char 
*found_textrels, char
                        } else \
                                printf("(optimized out)"); \
                        printf(" [0x%lX]\n", (unsigned long)offset_tmp); \
-                       if (be_verbose && objdump) { \
+                       if (be_verbose && objdump && func) { \
                                Elf ## B ## _Addr end_addr = offset_tmp + 
EGET(func->st_size); \
                                char *sysbuf; \
                                int ret; \

Reply via email to