[Mono-bugs] [Bug 667928] New: icalls with Rects as return types call native functions incorrectly.
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri Jan 28 08:26:43 EST 2011
https://bugzilla.novell.com/show_bug.cgi?id=667928
https://bugzilla.novell.com/show_bug.cgi?id=667928#c0
Summary: icalls with Rects as return types call native
functions incorrectly.
Classification: Mono
Product: Mono: Runtime
Version: 2.8.x
Platform: i386
OS/Version: Mac OS X 10.6
Status: NEW
Severity: Normal
Priority: P5 - None
Component: JIT
AssignedTo: lupus at novell.com
ReportedBy: lucas.meijer at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US)
AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10
Run test.cpp against test.cs,
test.cpp segfaults when doing mono_object_get_class(instance), however
instance should be pointing at a valid MonoObject. kumpera asked me to file a
bugreport, and mentioned it's related to having structs as return types.
Reproducible: Always
Steps to Reproduce:
run this test.cpp:
#include <glib.h>
#include <mono/jit/jit.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/debug-helpers.h>
#include <mono/metadata/mono-gc.h>
#include <mono/metadata/class.h>
struct Rectf
{
float top,left,width,height;
};
static Rectf FitScreen(MonoObject* instance, Rectf input, bool a, bool b)
{
//This crashes because instance points to what looks like randomness.
mono_object_get_class(instance);
Rectf r;
return r;
}
int main()
{
MonoDomain* domain = mono_jit_init_version ("Unity Root Domain",
"v2.0.50727");
MonoMethodDesc* desc = mono_method_desc_new("Test:doit",1);
MonoAssembly* ass = mono_domain_assembly_open (mono_domain_get (),
"test.dll");
MonoImage* img = mono_assembly_get_image(ass);
MonoMethod* m = mono_method_desc_search_in_image(desc,img);
mono_add_internal_call ("Test::FitScreen", (void*)FitScreen);
MonoObject* exc;
MonoObject* ret = mono_runtime_invoke(m,0,0,&exc);
return 0;
}
against this test.dll:
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential)]
struct Rect
{
public float left,top,width,height;
}
public class Test
{
static void doit()
{
Rect rect = new Rect();
var instance = new Test();
FitScreen(instance,rect,false,false);
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static Rect FitScreen (Test instance, Rect input, bool
something, bool somethingelse);
}
Actual Results:
crash
Expected Results:
no crash
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list