This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 410 - EigenSolver::eigenvectors() crashes when solving matrix with infinity (-1.#IND) in it
Summary: EigenSolver::eigenvectors() crashes when solving matrix with infinity (-1.#IN...
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Eigenvalues (show other bugs)
Version: 3.1
Hardware: All All
: Normal Unknown
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-23 07:12 UTC by Alex Melkozerov
Modified: 2019-12-04 11:25 UTC (History)
4 users (show)



Attachments

Description Alex Melkozerov 2012-01-23 07:12:17 UTC
Eigenvalues module crashes in release (or emits debug error in Debug mode) if one passes to Eigen::EigenSolver a 1x1 matrix with 1 indefinite element in it. A simple program to reproduce bug:

#include <Eigen/Eigenvalues>
typedef Eigen::MatrixXd EigenMatrix;

int main() {

	EigenMatrix A(1,1);
	A(0,0) = std::sqrt(-1.);
	Eigen::EigenSolver<EigenMatrix> solver(A);
	EigenMatrix V(1, 1);
	V(0,0) = solver.eigenvectors()(0,0).real();
	return 0;
}

The problem is in line 342 of EigenSolver.h (https://bitbucket.org/eigen/eigen/src/ec430a9cb055/Eigen/src/Eigenvalues/EigenSolver.h#cl-342): internal::isMuchSmallerThan() check returns false, and line 357
matV.col(j+1).normalize();
is executed although matV contains just 1 column. This causes assertion failure in debug and crashes program in release.

Quick and dirty fix: add to line 342 second condition: || n == 1.
Comment 1 Gael Guennebaud 2012-01-25 19:05:09 UTC
Thanks for the analyze of the error, though I rather added:

|| j+1==n


Fixed there:

https://bitbucket.org/eigen/eigen/changeset/d2189ba9dfd1/
changeset:   d2189ba9dfd1
date:        2012-01-25 19:02:31
summary:     fix bug 410: fix a possible out of range access in EigenSolver

https://bitbucket.org/eigen/eigen/changeset/b8c6abb0d78a/
changeset:   b8c6abb0d78a
branch:      3.0
Comment 2 Nobody 2019-12-04 11:25:37 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/410.

Note You need to log in before you can comment on or make changes to this bug.