This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] PR22167, NULL pointer dereference in scan_unit_for_symbols


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0d76029f92182c3682d8be2c833d45bc9a2068fe

commit 0d76029f92182c3682d8be2c833d45bc9a2068fe
Author: Alan Modra <amodra@gmail.com>
Date:   Sun Sep 24 14:35:33 2017 +0930

    PR22167, NULL pointer dereference in scan_unit_for_symbols
    
    	PR 22167
    	* dwarf2.c (scan_unit_for_symbols): Check u.blk->data is non-NULL.

Diff:
---
 bfd/ChangeLog | 5 +++++
 bfd/dwarf2.c  | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index af04da9..57f5ad3 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
 2017-09-24  Alan Modra  <amodra@gmail.com>
 
+	PR 22167
+	* dwarf2.c (scan_unit_for_symbols): Check u.blk->data is non-NULL.
+
+2017-09-24  Alan Modra  <amodra@gmail.com>
+
 	PR 22166
 	* elf.c (_bfd_elf_slurp_version_tables): Test sh_info on
 	SHT_GNU_verneed section for sanity.  Don't zalloc memory for
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 856c963..d1cf1aa 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -3210,7 +3210,8 @@ scan_unit_for_symbols (struct comp_unit *unit)
 		    case DW_FORM_block2:
 		    case DW_FORM_block4:
 		    case DW_FORM_exprloc:
-		      if (*attr.u.blk->data == DW_OP_addr)
+		      if (attr.u.blk->data != NULL
+			  && *attr.u.blk->data == DW_OP_addr)
 			{
 			  var->stack = 0;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]