Closed w1th0utnam3 closed 6 years ago
Can we just delete line 110?
I think that should work. The _local_index
is updated in the dereferencing operators of the iterator anyway. So these statements in the constructors seem redundant. I'll make a PR.
Detected using valgrind:
The
end()
method of theEntityRange
constructs anEntityIterator
: https://github.com/FEniCS/dolfinx/blob/64d27fd1fead5b874f4da9e096b99eb6c08a7a7a/cpp/dolfin/mesh/MeshIterator.h#L374 wheren
points beyond the last element of the range. In the Iterator's constructor, this address is dereferenced: https://github.com/FEniCS/dolfinx/blob/64d27fd1fead5b874f4da9e096b99eb6c08a7a7a/cpp/dolfin/mesh/MeshIterator.h#L110 causing an out of bounds read. It's not fatal but still undefined behavior.Possible fixes: