Bug 626 - No range check for sparse matrix
No range check for sparse matrix
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Sparse
unspecified
All All
: Normal Unknown
Assigned To: Nobody
:
: 641 (view as bug list)
Depends on:
Blocks: 3.2
  Show dependency treegraph
 
Reported: 2013-06-28 13:19 UTC by Kolja Brix
Modified: 2013-08-08 09:06 UTC (History)
3 users (show)



Attachments
Test for sparse matrix range check (1016 bytes, text/x-c++src)
2013-06-28 13:19 UTC, Kolja Brix
no flags Details

Description Kolja Brix 2013-06-28 13:19:25 UTC
Created attachment 361 [details]
Test for sparse matrix range check

There is no range check for sparse matrices:

For a standard SparseMatrix<double, Dynamic> (row major format?), elements above the upper column limit can be inserted, e.g. an element in column 11 in a 10 x 10 sparse matrix. There is no error or exception thrown.

Inserting an entry above the row limit usually leads to a segmentation fault.

Both behaviors are demonstrated in the example code attached.
Comment 1 Christoph Hertzberg 2013-06-28 13:36:42 UTC
Indeed, this is not checked.
Another thing: Dynamic should not be a allowed as template parameter. Sparse matrices are always dynamic sized. 
Only valid options at the moment are ColMajor (default) and RowMajor.
Comment 2 Gael Guennebaud 2013-06-28 16:16:56 UTC
Both fixed for both matrices and vectors:

https://bitbucket.org/eigen/eigen/commits/d3495e9a1994/
Changeset:   d3495e9a1994
User:        ggael
Date:        2013-06-28 15:56:43
Summary:     Bug 626: add compiletime check of the Options template parameter of SparseMatrix and SparseVector. Fix eval and plain_object for sparse objects.

https://bitbucket.org/eigen/eigen/commits/9998c8a1b9c0/
Changeset:   9998c8a1b9c0
User:        ggael
Date:        2013-06-28 16:16:02
Summary:     Fix bug 626: add assertion on input ranges for coeff* and insert members for sparse objects
Comment 3 Alexander Werner 2013-08-08 09:06:43 UTC
*** Bug 641 has been marked as a duplicate of this bug. ***

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