Skip to content

dgeev: memory corruption on non-finite input #5250

Closed
@AllinCottrell

Description

@AllinCottrell

I've found that in certain cases passing a matrix that contains "inf" values to dgeev results in memory corruption. I'm attaching a minimal test case, which I compiled on Fedora 40 with

gcc -O2 -g -o eigencrash eigencrash.c -lopenblaso -lgfortran

The test program accepts a single argument. When invoked as ./eigencrash ok the non-finite input is 3 x 3 and there's no crash (the returned eigenvalues are non-finite, as expected). Without the "ok" argument the input is 4 x 4 and a crash results. The output from this case is as follows:

dgeev (1): lwork = 136, info = 0
 ** On entry to DGEBAL parameter number  3 had an illegal value
 ** On entry to DGEHRD parameter number  2 had an illegal value
 ** On entry to DHSEQR parameter number  4 had an illegal value
dgeev (2): info = -4
eigevals: real, imag:
     -nan,      -nan
     -nan,      -nan
     -nan,      -nan
     -nan,      -nan
double free or corruption (out)
Aborted (core dumped)

I'm also attaching the valgrind log and gdb output for the crashing case.

eigencrash.c.txt

valgrind.log

gdb.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions