diff --git a/src/core/t-struct.c b/src/core/t-struct.c index e5f367ff05..282958c3ff 100644 --- a/src/core/t-struct.c +++ b/src/core/t-struct.c @@ -755,12 +755,15 @@ static REBOOL parse_field_type(struct Struct_Field *field, REBVAL *spec, REBVAL init = blk++; #endif if (field->array) { - if (IS_INTEGER(init)) { /* interpreted as a C pointer */ - void *ptr = (void *)VAL_INT64(init); - - /* assuming it's an valid pointer and holding enough space */ - memcpy(SERIES_SKIP(VAL_STRUCT_DATA_BIN(out), (REBCNT)offset), ptr, field->size * field->dimension); - } else if (IS_BLOCK(init)) { +// O: It is probably not a good idea to let access to C pointers! +// https://github.com/Oldes/Rebol-issues/issues/2567 +// if (IS_INTEGER(init)) { /* interpreted as a C pointer */ +// void *ptr = (void *)VAL_INT64(init); +// +// /* assuming it's an valid pointer and holding enough space */ +// memcpy(SERIES_SKIP(VAL_STRUCT_DATA_BIN(out), (REBCNT)offset), ptr, field->size * field->dimension); +// } else + if (IS_BLOCK(init)) { REBCNT n = 0; if (VAL_LEN(init) != field->dimension) { diff --git a/src/tests/units/struct-test.r3 b/src/tests/units/struct-test.r3 index b2b8b66df9..c58075bf04 100644 --- a/src/tests/units/struct-test.r3 +++ b/src/tests/units/struct-test.r3 @@ -154,6 +154,12 @@ Rebol [ error? e: try [make struct! [ a: [uint8!] probe random 100 ]] e/id = 'invalid-type ] +--test-- "Invalid array type initialisation" +;@@ https://github.com/Oldes/Rebol-issues/issues/2567 + --assert all [ + error? e: try [ make struct! [a: [int8! [2]] 1] ] ;- No crash! + e/id = 'expect-val + ] ===end-group===