[Mono-bugs] [Bug 477396] New: Marshal.StructureToPtr handles null pointers/delegates incorrectly

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Feb 18 14:58:27 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=477396


           Summary: Marshal.StructureToPtr handles null pointers/delegates
                    incorrectly
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: christian_hoff at gmx.net
         QAContact: mono-bugs at lists.ximian.com
                CC: mkestner at novell.com
          Found By: Development


When invoking StructureToPtr, delegates in the returned structure are never
NULL.

Suppose you have a class struct containing one delegate:
struct TestStruct {
TestDelegate test;
}

"test" is never set to null when it doesn't point to a C method. Invoking that
method results in a segfault.

See the attached test case for a minimal repro.
The unmanaged code is already compiled to a static lib; if it doesn't work for
you(probably only working on 64Bit machaines), recompile it using:
gcc -c -fPIC ./main.c -o ./main.o
gcc -shared -Wl,-soname,libptr_to_struct.so.1 -o libptr_to_struct.so  ./main.o

As this is a blocker for a Gtk# patch, it would be really nice if you could
have a look at that bug soon :-)

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list