Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion libsrc/meshing/topology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,18 @@ namespace netgen
// cout << "v2f:" << endl << v2f << endl;

parent_faces.SetSize (nfa);
parent_faces = { -1, { -1, -1, -1, -1 } };
// NOTE: `parent_faces = { -1, { -1, -1, -1, -1 } };` looks like a
// broadcast-initialize of every entry to a "no parent" sentinel,
// but Array::operator=(std::initializer_list<T>) does
// `*this = Array<T>(list)` (see core/array.hpp) -- with a single
Comment thread
ahojukka5 marked this conversation as resolved.
// T{-1,{-1,-1,-1,-1}} element, that silently REPLACES the
Comment thread
ahojukka5 marked this conversation as resolved.
// just-`SetSize`d array with a size-1 array, discarding `nfa`.
// Every entry not explicitly written by one of the branches below
// is then read (via GetParentFaces) out of bounds of that
// size-1 array -- uninitialized/adjacent memory, not a defined
// "no parent" value. Initialize every entry explicitly instead.
for (auto i : Range(nfa))
parent_faces[i] = { -1, { -1, -1, -1, -1 } };

for (auto i : Range(nfa))
{
Expand Down