From: Nick Clifton Date: Mon, 11 Feb 2019 16:15:59 +0000 (+0000) Subject: Fix a NULL pointer dereference in nm, when parsing a corrupt file. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c6f021093dbd26b4d8e761e9a19af817e9f2561f;p=thirdparty%2Fbinutils-gdb.git Fix a NULL pointer dereference in nm, when parsing a corrupt file. PR 24168 * nm.c (print_symbol): Check for NULL contents of the sym_ptr_ptr field. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 0eba8440e8b..ad4f226edf4 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2019-02-11 Nick Clifton + + PR 24168 + * nm.c (print_symbol): Check for NULL contents of the sym_ptr_ptr + field. + 2018-03-19 H.J. Lu Backport from master branch diff --git a/binutils/nm.c b/binutils/nm.c index e46fffc796f..afaea56714b 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -976,6 +976,7 @@ print_symbol (bfd * abfd, } symname = bfd_asymbol_name (sym); + for (i = 0; i < seccount; i++) { long j; @@ -985,7 +986,9 @@ print_symbol (bfd * abfd, arelent *r; r = relocs[i][j]; + if (r->sym_ptr_ptr != NULL + && * r->sym_ptr_ptr != NULL && (*r->sym_ptr_ptr)->section == sym->section && (*r->sym_ptr_ptr)->value == sym->value && strcmp (symname,