Skip to content

Commit 035c858

Browse files
committed
Allow only primitive types/enums in RuntimeHelpers.InitializeArray ().
1 parent e34089d commit 035c858

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Diff for: mono/metadata/icall.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -854,12 +854,9 @@ ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray (MonoAr
854854
int align;
855855
const char *field_data;
856856

857-
if (MONO_TYPE_IS_REFERENCE (type) ||
858-
(type->type == MONO_TYPE_VALUETYPE &&
859-
(!mono_type_get_class (type) ||
860-
mono_type_get_class (type)->has_references))) {
857+
if (MONO_TYPE_IS_REFERENCE (type) || type->type == MONO_TYPE_VALUETYPE) {
861858
MonoException *exc = mono_get_exception_argument("array",
862-
"Cannot initialize array containing references");
859+
"Cannot initialize array of non-primitive type.");
863860
mono_raise_exception (exc);
864861
}
865862

0 commit comments

Comments
 (0)