Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-06-29 00:56:30 +0300
committerHans Goudey <h.goudey@me.com>2021-06-29 00:56:30 +0300
commit2271b9b584ae7af25009ae0c00a55a8feac1c70c (patch)
tree634cf7e2bd8b3267cdb0a2235bf5a099a7fe4d32 /source/blender/blenkernel/intern/mesh_convert.c
parentd0e6b59cd164110a54fa8cc2c95b6873f50e9605 (diff)
Cleanup: Avoid ASAN report when converting displist to mesh
Don't call `memcpy` with a null destination (and 0 size).
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_convert.c')
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c
index 825963a2210..cfad5e1100d 100644
--- a/source/blender/blenkernel/intern/mesh_convert.c
+++ b/source/blender/blenkernel/intern/mesh_convert.c
@@ -545,10 +545,18 @@ Mesh *BKE_mesh_new_nomain_from_curve_displist(const Object *ob, const ListBase *
mesh = BKE_mesh_new_nomain(totvert, totedge, 0, totloop, totpoly);
mesh->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
- memcpy(mesh->mvert, allvert, totvert * sizeof(MVert));
- memcpy(mesh->medge, alledge, totedge * sizeof(MEdge));
- memcpy(mesh->mloop, allloop, totloop * sizeof(MLoop));
- memcpy(mesh->mpoly, allpoly, totpoly * sizeof(MPoly));
+ if (totvert != 0) {
+ memcpy(mesh->mvert, allvert, totvert * sizeof(MVert));
+ }
+ if (totedge != 0) {
+ memcpy(mesh->medge, alledge, totedge * sizeof(MEdge));
+ }
+ if (totloop != 0) {
+ memcpy(mesh->mloop, allloop, totloop * sizeof(MLoop));
+ }
+ if (totpoly != 0) {
+ memcpy(mesh->mpoly, allpoly, totpoly * sizeof(MPoly));
+ }
if (alluv) {
const char *uvname = "UVMap";