This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Prevent illegal accesses for bfd null pointers
- From: Thiemo Seufer <ica2_ts at csv dot ica dot uni-stuttgart dot de>
- To: binutils at sources dot redhat dot com
- Date: Wed, 14 May 2003 07:01:35 +0200
- Subject: [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;