Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

out-of-bounds array access #14

Open
g2721 opened this issue Oct 6, 2024 · 1 comment
Open

out-of-bounds array access #14

g2721 opened this issue Oct 6, 2024 · 1 comment

Comments

@g2721
Copy link

g2721 commented Oct 6, 2024

In the Inverse function there is a out-of-bounds array access that may cause hard faults on embedded hardware.

In Lapack/Src/dgetrf.c towards the end of the file the following loop will run for one to many iterations. (I.e. beginn and end at the wrong index)

    for(int i = 1; i <= min(*m, *n); i++)
	IPIV_d[i] = (double) ipiv[i];

Example if Matrix size is 9x9 min(*m, *n) will be 9.
ipiv[i] and IPIV_d[i] will have a length of 9 each. Meaning they should be accessed from [0] to [8]. Instead [1] to [9] is used.

Fix should most likely look like this:

for(int i = 0; i < min(*m, *n); i++){
	IPIV_d[i] = (double) ipiv[i];
	}
@songhongxiang
Copy link

I've encountered this issue as well. It occurs in debug mode under the ARM system, but it doesn't exist in release mode. The error is "Segmentation fault (core dumped)".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants