Fix undefined behavior in Block access

This commit is contained in:
Jeremy Nimmer
2023-02-01 00:40:45 +00:00
committed by Rasmus Munk Larsen
parent 4a58f30aa0
commit a1cdcdb038
2 changed files with 20 additions and 4 deletions

View File

@@ -198,6 +198,7 @@ public:
pointer_based_stl_iterator() EIGEN_NO_THROW : m_ptr(0) {}
pointer_based_stl_iterator(XprType& xpr, Index index) EIGEN_NO_THROW : m_incr(xpr.innerStride())
{
eigen_assert(xpr.data() != nullptr || index == 0 || m_incr.value() == 0);
m_ptr = xpr.data() + index * m_incr.value();
}