diff --git a/Modules/Core/Common/include/itkPointSet.h b/Modules/Core/Common/include/itkPointSet.h index 9b8f6d75e94..aeb3db8defe 100644 --- a/Modules/Core/Common/include/itkPointSet.h +++ b/Modules/Core/Common/include/itkPointSet.h @@ -164,7 +164,8 @@ class ITK_TEMPLATE_EXPORT PointSet : public DataObject void SetPoints(PointsContainer *); - /** Set the points container using a 1D vector. */ + /** Set the points container using a 1D vector. + \warning This member function is unsafe. It may just work, but it may also lead to undefined behavior. */ void SetPoints(PointsVectorContainer *); diff --git a/Modules/Core/Common/include/itkPointSet.hxx b/Modules/Core/Common/include/itkPointSet.hxx index 0aed6b93cae..f4731b7d441 100644 --- a/Modules/Core/Common/include/itkPointSet.hxx +++ b/Modules/Core/Common/include/itkPointSet.hxx @@ -73,6 +73,8 @@ PointSet::SetPoints(PointsVectorContainer * { itkExceptionMacro("Number of entries in given 1d array incompatible with the point dimension"); } + + // Note: this cast is unsafe. It may lead to undefined behavior. auto * pointsPtr = reinterpret_cast(points); m_PointsContainer = pointsPtr;