From 8cb4518f339339736a7f408dad20244c5677d03f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Fri, 20 Dec 2024 14:29:28 +0100 Subject: [PATCH] Fix invalid string access in BoundaryLayerTool When AddFaceDescriptor reallocates the array the fd reference becomes dangling. See #203 --- libsrc/meshing/boundarylayer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libsrc/meshing/boundarylayer.cpp b/libsrc/meshing/boundarylayer.cpp index 3eaaa508..c472f919 100644 --- a/libsrc/meshing/boundarylayer.cpp +++ b/libsrc/meshing/boundarylayer.cpp @@ -723,7 +723,8 @@ namespace netgen new_fd.SetBCProperty(new_si); mesh.AddFaceDescriptor(new_fd); si_map[facei] = new_si; - mesh.SetBCName(new_si-1, fd.GetBCName()); + // AddFaceDescriptor may reallocate, fd is invalidated + mesh.SetBCName(new_si-1, mesh.GetFaceDescriptor(facei).GetBCName()); face_done.SetBit(facei); } }