From e7248b26a1ed53fa030c5c459f7ea095dfd276ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20S=C3=A1nchez?= Date: Thu, 19 May 2022 22:29:48 +0000 Subject: [PATCH] Prevent BDCSVD crash caused by index out of bounds. (cherry picked from commit 028ab12586ee1244755455107fcba66493b336d6) --- Eigen/src/SVD/BDCSVD.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Eigen/src/SVD/BDCSVD.h b/Eigen/src/SVD/BDCSVD.h index a76a8dd04..6dcb986c1 100644 --- a/Eigen/src/SVD/BDCSVD.h +++ b/Eigen/src/SVD/BDCSVD.h @@ -978,8 +978,8 @@ void BDCSVD::computeSingVals(const ArrayRef& col0, const ArrayRef& d // perturb singular value slightly if it equals diagonal entry to avoid division by zero later // (deflation is supposed to avoid this from happening) // - this does no seem to be necessary anymore - -// if (singVals[k] == left) singVals[k] *= 1 + NumTraits::epsilon(); -// if (singVals[k] == right) singVals[k] *= 1 - NumTraits::epsilon(); + // if (singVals[k] == left) singVals[k] *= 1 + NumTraits::epsilon(); + // if (singVals[k] == right) singVals[k] *= 1 - NumTraits::epsilon(); } } @@ -1033,7 +1033,14 @@ void BDCSVD::perturbCol0 std::cout << " " << "j=" << j << "\n"; } #endif - Index j = i 0 ? perm(l-1) : i; #ifdef EIGEN_BDCSVD_SANITY_CHECKS if(!(dk!=Literal(0) || diag(i)!=Literal(0))) {