[Mono-bugs] [Bug 348522] New: SIGABRT when a custom Binder doesn' t convert parameters correctly
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Dec 13 13:25:36 EST 2007
https://bugzilla.novell.com/show_bug.cgi?id=348522
Summary: SIGABRT when a custom Binder doesn't convert parameters
correctly
Product: Mono: Class Libraries
Version: SVN
Platform: i686
OS/Version: openSUSE 10.3
Status: NEW
Severity: Normal
Priority: P5 - None
Component: CORLIB
AssignedTo: mono-bugs at ximian.com
ReportedBy: rkvinge at novell.com
QAContact: mono-bugs at ximian.com
Found By: ---
Repro:
using System;
using System.Reflection;
using System.Globalization;
class C {
public void F (int code)
{
}
static void Main ()
{
BindingFlags flags = BindingFlags.Instance |
BindingFlags.Public | BindingFlags.InvokeMethod;
typeof (C).InvokeMember ("F", flags, new LateBinder (), new C
(), new object [] {Missing.Value}, null, null, null);
}
}
class LateBinder : Binder {
public override MethodBase BindToMethod (BindingFlags bindingAttr,
MethodBase [] match,
ref object [] args,
ParameterModifier []
modifiers,
CultureInfo culture,
string [] names,
out object state)
{
state = null;
return match [0];
}
public override object ChangeType (object value, Type type1,
CultureInfo culture)
{
// This is obviously not correct, but still it shouldn't crash.
return value;
}
// The rest is just to please the compiler
public override FieldInfo BindToField(System.Reflection.BindingFlags a,
System.Reflection.FieldInfo[] b, object c, System.Globalization.CultureInfo d)
{
return null;
}
public override void ReorderArgumentArray(ref object[] a, object b) {
}
public override MethodBase SelectMethod(System.Reflection.BindingFlags
a, System.Reflection.MethodBase[] b, System.Type[] c,
System.Reflection.ParameterModifier[] d) {
return null;
}
public override PropertyInfo
SelectProperty(System.Reflection.BindingFlags a,
System.Reflection.PropertyInfo[] b, System.Type c, System.Type[] d,
System.Reflection.ParameterModifier[] e) {
return null;
}
}
Results in:
** ERROR **: file object.c: line 3988 (mono_object_unbox): assertion failed:
(obj->vtable->klass->valuetype)
aborting...
Stacktrace:
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke
(object,object[]) <0x00004>
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke
(object,object[]) <0xffffffff>
at System.Reflection.MonoMethod.Invoke
(object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
<0x0009a>
at System.MonoType.InvokeMember
(string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[],System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,string[])
<0x003f4>
at C.Main () <0x000a8>
at (wrapper runtime-invoke) C.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
mono [0x817b26f]
[0xffffe440]
/lib/libc.so.6(abort+0x101) [0xb7d3b1e1]
/usr/lib/libglib-2.0.so.0(g_logv+0x47a) [0xb7ee43fa]
/usr/lib/libglib-2.0.so.0(g_log+0x29) [0xb7ee4439]
/usr/lib/libglib-2.0.so.0(g_assert_warning+0x70) [0xb7ee44b0]
mono [0x80976d4]
mono(mono_runtime_invoke_array+0x1bd) [0x809c65d]
mono [0x80a4af6]
[0xb796232d]
[0xb7961a0b]
[0xb795fc5d]
[0xb795f4a1]
[0xb795f1be]
mono(mono_runtime_exec_main+0xbb) [0x809e90b]
mono(mono_runtime_run_main+0x173) [0x809ec03]
mono(mono_main+0x6a9) [0x805ae39]
mono [0x805a282]
/lib/libc.so.6(__libc_start_main+0xe0) [0xb7d25fe0]
mono [0x805a1f1]
Note: The code is nasty, and the crash can easily be worked around, so no hurry
on this one :)
--
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