Closed BradWhitlock closed 8 months ago
I made a strided structured topo and wanted to compute its length using topology::length(). It crashes because the number of children (due to offsets, strides) causes the code to index out of bounds.
int main() { conduit::Node n; conduit::Node &coords = n["coordsets/coarse_coords"]; coords["type"] = "explicit"; coords["values/x"] = std::vector<double>{ 0., 1., 0., 1., 0., 1., 0., 1., 0., 1., 0., 1., 0., 1.}; coords["values/y"] = std::vector<double>{ 0., 0., 1., 1., 2., 2., 3., 3., 4., 4., 5., 5., 6., 6.}; conduit::Node &topo = n["topologies/coarse"]; topo["type"] = "structured"; topo["coordset"] = "coarse_coords"; topo["elements/dims/i"] = 1; topo["elements/dims/j"] = 6; topo["elements/dims/k"] = 0; topo["elements/dims/offsets"] = std::vector<int>{2,2}; topo["elements/dims/strides"] = std::vector<int>{1,5}; n.print(); conduit::Node info; bool ok = conduit::blueprint::mesh::verify(n, info); cout << "ok = " << ok << endl; info.print(); // This crashes! auto len = conduit::blueprint::mesh::topology::length(topo); cout << "len = " << len << endl; }
Working on a fix.
I made a strided structured topo and wanted to compute its length using topology::length(). It crashes because the number of children (due to offsets, strides) causes the code to index out of bounds.