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

Runtime errors because of fixed length vectors in casadi_cvx.hpp #3169

Open
victorfors opened this issue May 3, 2023 · 2 comments · May be fixed by #3179
Open

Runtime errors because of fixed length vectors in casadi_cvx.hpp #3169

victorfors opened this issue May 3, 2023 · 2 comments · May be fixed by #3179

Comments

@victorfors
Copy link
Contributor

There are some stack-allocated vectors in casadi_cvx.hpp that limit the maximum size the input matrix can have. If your matrix is larger you run into undefined behavior, stack smashing or segmentation fault errors.

T1 beta[100] in the casadi_cvx function limits the input matrix to I believe 102x102.
T1 pp[1000] in casadi_cvx_tri limits the input matrix to 1000x1000.

@victorfors victorfors changed the title Fixed length vectors in casadi_cvx.hpp Runtime errors because of fixed length vectors in casadi_cvx.hpp May 3, 2023
@victorfors
Copy link
Contributor Author

I think it makes most sense to create them at the same places as other work vectors used in these functions. Let me know if you think otherwise. I will make a PR with a suggested fix.

@victorfors
Copy link
Contributor Author

I have made an implementation of this but it seems to break the backwards compatibility (test below). I assume any commits that updates the size of the work vector would do so.

https://github.com/casadi/casadi/blob/main/test/python/serialize.py

@victorfors victorfors linked a pull request May 10, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant