This is the mail archive of the gcc-bugs@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]

[Bug libgcj/11951] New: natMethod.cc (_Jv_CallAnyMethodA) should clear ffi_result before ffi_call


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11951

           Summary: natMethod.cc (_Jv_CallAnyMethodA) should clear
                    ffi_result before ffi_call
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mark at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org

This came up while debugging gjdoc with libxmlj (a JNI wrapper around libxml).
Don't have time now to create a test and a real patch.

diff -u -r1.32 natMethod.cc
--- java/lang/reflect/natMethod.cc      21 Jul 2003 01:54:06 -0000      1.32
+++ java/lang/reflect/natMethod.cc      16 Aug 2003 20:59:15 -0000
@@ -427,6 +427,10 @@
     jdouble d;
   } ffi_result;
  
+  // Result should be cleared since ffi_call might throw an exception.
+  // Then the result might still be used in JNI anyway.
+  ffi_result.o = NULL;
+
   try
     {
       ffi_call (&cif, (void (*)()) meth->ncode, &ffi_result, values);


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