This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 1172

Summary: GCC UBSAN error of sparse Cholesky decomposition
Product: Eigen Reporter: Yixuan Qiu <yixuan.qiu>
Component: SparseAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: Crash CC: chtz, gael.guennebaud
Priority: Normal    
Version: 3.2   
Hardware: x86 - 64-bit   
OS: Linux   
Whiteboard:

Description Yixuan Qiu 2016-02-24 18:03:30 UTC
Hi All,

GCC UBSAN reports runtime errors on sparse Cholesky decomposition.
Below is a minimal example:

========================================
#include <Eigen/Sparse>

int main()
{
    Eigen::SparseMatrix<double> mat(10, 10);

    for(int i = 0; i < mat.rows(); i++)
        mat.insert(i, i) = 1.0;

    Eigen::SimplicialLDLT< Eigen::SparseMatrix<double> > ll(mat);

    return 0;
}

========================================

Compiling this code with "g++ -g -fsanitize=undefined,address -I. test.cpp" and running it gives

Eigen/src/SparseCore/CompressedStorage.h:108:55: runtime error: reference binding to null pointer of type 'Index'
Eigen/src/SparseCore/CompressedStorage.h:105:55: runtime error: reference binding to null pointer of type 'Scalar'


Thanks.


OS: Fedora 23 64-bit
Eigen: most recent 3.2 branch (also occurs in 3.3 branch)
GCC: g++ (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2)
Comment 1 Gael Guennebaud 2016-02-27 14:10:06 UTC
Thank you for the report. 

https://bitbucket.org/eigen/eigen/commits/cb84354748ba/
https://bitbucket.org/eigen/eigen/commits/d1c22058362b/ (3.2)
Summary:     Bug 1172: make valuePtr and innderIndexPtr properly return null for empty matrices.
Comment 2 Yixuan Qiu 2016-02-27 15:18:23 UTC
Thanks for the quick fix!
Comment 3 Nobody 2019-12-04 15:27:41 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/1172.