elf32-hppa NULL pointer deref

Alan Modra alan@linuxcare.com.au
Wed Mar 21 00:08:00 GMT 2001


Fixes a possible hole if default linker scripts aren't used.  Applying
trunk and branch.

bfd/ChangeLog
	* elf32-hppa.c (elf32_hppa_set_gp): Check sec->output_section
	non-NULL before attempting to dereference.

Alan Modra
-- 
Linuxcare

Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.29
diff -u -p -r1.29 elf32-hppa.c
--- elf32-hppa.c	2001/03/15 13:47:56	1.29
+++ elf32-hppa.c	2001/03/21 08:01:59
@@ -3089,7 +3089,7 @@ elf32_hppa_set_gp (abfd, info)
 	}
     }
 
-  if (sec != NULL)
+  if (sec != NULL && sec->output_section != NULL)
     gp_val += sec->output_section->vma + sec->output_offset;
 
   elf_gp (abfd) = gp_val;




More information about the Binutils mailing list