-
-
Notifications
You must be signed in to change notification settings - Fork 668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PointSet::SetPoints(PointsVectorContainer *)
overload leads to undefined behavior
#4848
Labels
type:Bug
Inconsistencies or issues which will cause an incorrect result under some or all circumstances
Comments
N-Dekker
added
the
type:Bug
Inconsistencies or issues which will cause an incorrect result under some or all circumstances
label
Sep 13, 2024
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this issue
Sep 17, 2024
Aims to mitigate issue InsightSoftwareConsortium#4848 "`PointSet::SetPoints(PointsVectorContainer *)` overload leads to undefined behavior"
dzenanz
pushed a commit
that referenced
this issue
Sep 20, 2024
Aims to mitigate issue #4848 "`PointSet::SetPoints(PointsVectorContainer *)` overload leads to undefined behavior"
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this issue
Oct 21, 2024
When the points are specified by a flat VectorContainer of coordinates, passing those points to `SetPoints` may lead to undefined behavior. `SetPointsByCoordinates` is in that case preferred. - Partially addresses issue InsightSoftwareConsortium#4848 "`PointSet::SetPoints(PointsVectorContainer *)` overload leads to undefined behavior"
N-Dekker
added a commit
to N-Dekker/ITK
that referenced
this issue
Oct 24, 2024
The SetPoints calls in two serialization tests appear unsafe, as was reported by issue InsightSoftwareConsortium#4848 "`PointSet::SetPoints(PointsVectorContainer *)` overload leads to undefined behavior". With this commit, those tests try both using SetPointsByCoordinates and using the unsafe SetPoints overload.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
type:Bug
Inconsistencies or issues which will cause an incorrect result under some or all circumstances
Description
PointSet::SetPoints(PointsVectorContainer * points)
internally casts its argument to aPointsContainer *
:ITK/Modules/Core/Common/include/itkPointSet.hxx
Line 76 in 9a5dade
This leads to undefined behavior, when the
PointsVectorContainer
object is being used as aPointsContainer
object.Steps to Reproduce
The test code already has undefined behavior, even if it might just work on the currently tested platforms:
ITK/Modules/Core/Common/test/itkPointSetTest.cxx
Lines 102 to 127 in 9a5dade
Versions
PointSet::SetPoints(PointsVectorContainer *)
overload is introduced by pull request ENH: Support for Mesh serialization #3154 commit 6827360 "ENH: Adding SetPoints in PointSet for 1D input array", merged on Mar 16, 2022, and included with both v5.3.0 and v5.4.0.Additional Information
Discussed before at #3154 (comment), with @PranjalSahu
The text was updated successfully, but these errors were encountered: