Fix #125404: Crash converting matrix attribute

The allocation for the new attribute array ignored type alignment.
This commit is contained in:
Hans Goudey
2024-07-25 11:04:31 -04:00
parent 7e9771c9de
commit 37fca25820

View File

@@ -923,7 +923,8 @@ bool ED_geometry_attribute_convert(Mesh *mesh,
const GVArray varray = *attributes.lookup_or_default(name_copy, dst_domain, dst_type);
const CPPType &cpp_type = varray.type();
void *new_data = MEM_malloc_arrayN(varray.size(), cpp_type.size(), __func__);
void *new_data = MEM_mallocN_aligned(
varray.size() * cpp_type.size(), cpp_type.alignment(), __func__);
varray.materialize_to_uninitialized(new_data);
attributes.remove(name_copy);
if (!attributes.add(name_copy, dst_domain, dst_type, bke::AttributeInitMoveArray(new_data))) {