From bac314a6665ce22f22a27a79518747f112b3f2e1 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Tue, 26 Apr 2022 23:26:19 +0200 Subject: [PATCH] fix range-check exception for 0-sized array --- libsrc/meshing/python_mesh.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index 7fdc395d..382d3923 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -723,7 +723,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) strs = geom_part_string.size(); // buf = new char[strs]; buf.SetSize(strs); - memcpy(&buf[0], geom_part_string.c_str(), strs*sizeof(char)); + memcpy(buf.Data(), geom_part_string.c_str(), strs*sizeof(char)); delete infile; } @@ -810,7 +810,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) shared_ptr geo; if(buf.Size()) { // if we had geom-info in the file, take it - istringstream geom_infile(string((const char*)&buf[0], buf.Size())); + istringstream geom_infile(string((const char*)buf.Data(), buf.Size())); geo = geometryregister.LoadFromMeshFile(geom_infile); } if(geo!=nullptr) mesh->SetGeometry(geo);