This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

libffi err_bad_typedef.c fix


The err_bad_typedef fails due to a null pointer deference on
my athlon 64 system. The attached patch notices that the pointer
is NULL and returns ERR_BAD_TYPEDEF instead of dereferencing it.

This fixes the err_bad_typedef.c execution tests. I have left
them as expected failures for the moment. I believe the bug
is ABI independent.

Please Cc; any replies to me because I get far too much email
already and am not a subscriber to the gcc-patches list.

Duncan Simpson

--- libffi/ChangeLog.dist       2009-09-02 00:30:05.958626045 +0100
+++ libffi/ChangeLog    2009-09-02 00:31:34.170629335 +0100
@@ -1,3 +1,8 @@
+2009-09-92  Duncan Simpson <dps@simpson.demon.co.uk>
+
+       * src/prep_cif.c: In initialise_aggregate return ERR_BAD_TYPEDEF
+       instead of dereferencing NULL when arg->elements==NULL.
+
 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

        * configure.ac (AC_PREREQ): Bump to 2.64.
--- libffi/src/prep_cif.c.dist  2009-08-29 01:26:59.222129382 +0100
+++ libffi/src/prep_cif.c       2009-09-02 00:16:01.730137983 +0100
@@ -45,6 +45,8 @@

ptr = &(arg->elements[0]);

+  if (ptr==NULL)
+      return FFI_BAD_TYPEDEF;
   while ((*ptr) != NULL)
     {
       if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK))


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