Skip to content

Commit cfa536f

Browse files
jonchamMichael DeRoy
authored andcommitted
Raise marshaling exception rather than aborting when marshaling invalid data type as array (case 935726)
1 parent fd2dd4c commit cfa536f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mono/metadata/marshal.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,9 +1616,11 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
16161616
mono_mb_emit_byte (mb, CEE_STIND_REF);
16171617
break;
16181618
}
1619-
case MONO_MARSHAL_CONV_ARRAY_LPARRAY:
1620-
g_error ("Structure field of type %s can't be marshalled as LPArray", mono_class_from_mono_type (type)->name);
1619+
case MONO_MARSHAL_CONV_ARRAY_LPARRAY: {
1620+
char *msg = g_strdup_printf ("Structure field of type %s can't be marshalled as LPArray", mono_class_from_mono_type (type)->name);
1621+
mono_mb_emit_exception_marshal_directive (mb, msg);
16211622
break;
1623+
}
16221624

16231625
#ifndef DISABLE_COM
16241626
case MONO_MARSHAL_CONV_OBJECT_INTERFACE:

0 commit comments

Comments
 (0)