-
Notifications
You must be signed in to change notification settings - Fork 614
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
SLSQP crashes on bad problem dimensions (more equality constraints than variables) #592
Labels
Comments
jschueller
added a commit
to jschueller/nlopt
that referenced
this issue
Feb 17, 2025
Closes stevengj#592
Merged
I guess it would be enough to check this before any allocation is made |
jschueller
added a commit
to jschueller/nlopt
that referenced
this issue
Feb 17, 2025
Closes stevengj#592
stevengj
added a commit
that referenced
this issue
Feb 18, 2025
* slsqp: check p>n Closes #592 * Update src/algs/slsqp/slsqp.c --------- Co-authored-by: Steven G. Johnson <[email protected]>
kkofler
added a commit
to kkofler/nlopt
that referenced
this issue
Feb 24, 2025
src/algs/slsqp/slsqp.c (src/algs/slsqp/slsqp.c): Fix the check for more equality constraints than variables (introduced by PR stevengj#593 to fix stevengj#592) so that vector constraints (mconstraints) are correctly counted: the count to consider here is ptot (the total number of scalar equality constraints), not p (the number of equality constraints that may be vector constraints).
kkofler
added a commit
to kkofler/nlopt
that referenced
this issue
Feb 24, 2025
src/algs/slsqp/slsqp.c (src/algs/slsqp/slsqp.c): Fix the check for more equality constraints than variables (introduced by PR stevengj#593 to fix stevengj#592) so that vector constraints (mconstraints) are correctly counted: the count to consider here is ptot (the total number of scalar equality constraints), not p (the number of equality constraints that may be vector constraints).
jschueller
pushed a commit
that referenced
this issue
Feb 25, 2025
src/algs/slsqp/slsqp.c (src/algs/slsqp/slsqp.c): Fix the check for more equality constraints than variables (introduced by PR #593 to fix #592) so that vector constraints (mconstraints) are correctly counted: the count to consider here is ptot (the total number of scalar equality constraints), not p (the number of equality constraints that may be vector constraints).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happened?
When attempting to solve a problem with more equality constraints than variables, the first invocation of
slsqp
(by thenlopt_slsqp
wrapper) is supposed to return the error code 2 (number of equality constraints > n). But before it returns that error, it does several operations that end up overflowing the allocated workspace. So, a segmentation fault or a "double free or corruption" usually (but not in all contexts) happens before the error can be properly reported.How to reproduce the issue?
Use the
test/slsqpcrashtest.c
from this commit:kkofler@e73791b
Version
2.10.0
Operating System
Linux
Installation media
from source
Additional Context
The reproducer is a standalone version of the reproducer we originally had at DAGOPT. It corresponds to the problem
lib_large/Lib2/grouping.mod
in the COCONUT testset. Smaller reproducers are probably possible as long as the number of equality constraints exceeds the number of variables.The text was updated successfully, but these errors were encountered: