GDCM
GDCM copied to clipboard
Iterator invalidation bug
This DS.Remove() invalidates the iterator it because it deletes the current element of the std::set within DS.
This is a use-after-free, that in rare circumstances can lead to memory corruption (but in practice, for single-threaded programs, has possibly never actually caused any issues).
The removal is extraneous anyways, due to the subsequent DS = copy.