This is the mail archive of the binutils@sources.redhat.com 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]

[PATCH] Prevent illegal accesses for bfd null pointers


Hello All,

this patch prevents illegal accesses for bfd null pointers (and fails
explicitly for writes in this case).


Thiemo


2003-05-14  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>

	/bfd/ChangeLog
	* bfd.c (_bfd_get_gp_value): Prevent illegal access for abfd null
	pointers.
	(_bfd_set_gp_value): Likewise.


diff -BurpNX /bigdisk/src/gcc-exclude source-orig/bfd/bfd.c source/bfd/bfd.c
--- source-orig/bfd/bfd.c	Sat Mar  1 00:43:35 2003
+++ source/bfd/bfd.c	Fri May  9 21:18:41 2003
@@ -894,6 +894,8 @@ bfd_vma
 _bfd_get_gp_value (abfd)
      bfd *abfd;
 {
+  if (! abfd)
+    return 0;
   if (abfd->format != bfd_object)
     return 0;
 
@@ -912,6 +914,8 @@ _bfd_set_gp_value (abfd, v)
      bfd *abfd;
      bfd_vma v;
 {
+  if (! abfd)
+    BFD_FAIL ();
   if (abfd->format != bfd_object)
     return;
 


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