Skip to content

Commit

Permalink
2006-08-31 Zoltan Varga <vargaz@gmail.com>
Browse files Browse the repository at this point in the history
	* marshal.c (emit_marshal_array): Avoid crash when a parameter with type array is 
	missing a [MarshalAs] directive. Fixes #79203.

svn path=/trunk/mono/; revision=64602
  • Loading branch information
vargaz committed Aug 31, 2006
1 parent 432e2f5 commit 0d7bb13
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mono/metadata/ChangeLog
@@ -1,5 +1,8 @@
2006-08-31 Zoltan Varga <vargaz@gmail.com>

* marshal.c (emit_marshal_array): Avoid crash when a parameter with type array is
missing a [MarshalAs] directive. Fixes #79203.

* marshal.c (mono_marshal_load_type_info): Fix a race in initializing
klass->marshal_info. Fixes #79217.

Expand Down
9 changes: 9 additions & 0 deletions mono/metadata/marshal.c
Expand Up @@ -6472,6 +6472,11 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t,
mono_mb_emit_exception_marshal_directive (mb, msg);
return conv_arg;
}
if (!spec) {
char *msg = g_strdup ("[MarshalAs] attribute required to marshal arrays to managed code.");
mono_mb_emit_exception_marshal_directive (mb, msg);
return conv_arg;
}
if (spec->native != MONO_NATIVE_LPARRAY) {
char *msg = g_strdup ("Non LPArray marshalling of arrays to managed code is not implemented.");
mono_mb_emit_exception_marshal_directive (mb, msg);
Expand Down Expand Up @@ -6637,6 +6642,10 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t,
int index_var, dest_ptr, loc, esize, param_num, num_elem;
MonoMarshalConv conv;
gboolean is_string = FALSE;

if (!spec)
/* Already handled in CONV_IN */
break;

/* These are already checked in CONV_IN */
g_assert (!t->byref);
Expand Down

0 comments on commit 0d7bb13

Please sign in to comment.