Fix inverse nullptr/asan errors for LU.

For empty or single-column matrices, the current `PartialPivLU`
currently dereferences a `nullptr` or accesses memory out-of-bounds.
Here we adjust the checks to avoid this.
This commit is contained in:
Antonio Sanchez
2021-07-01 13:41:04 -07:00
parent eb04775903
commit 154f00e9ea
2 changed files with 8 additions and 1 deletions

View File

@@ -135,6 +135,8 @@ EIGEN_DECLARE_TEST(inverse)
CALL_SUBTEST_5( inverse(MatrixXf(s,s)) );
TEST_SET_BUT_UNUSED_VARIABLE(s)
CALL_SUBTEST_5( inverse_zerosized<float>() );
CALL_SUBTEST_5( inverse(MatrixXf(0, 0)) );
CALL_SUBTEST_5( inverse(MatrixXf(1, 1)) );
s = internal::random<int>(25,100);
CALL_SUBTEST_6( inverse(MatrixXcd(s,s)) );