Skip to content

Commit

Permalink
slsqp: check p>n
Browse files Browse the repository at this point in the history
Closes #592
  • Loading branch information
jschueller committed Feb 17, 2025
1 parent 128b04c commit 650b84f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/algs/slsqp/slsqp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2459,6 +2459,12 @@ nlopt_result nlopt_slsqp(unsigned n, nlopt_func f, void *f_data,
unsigned max_cdim;
int want_grad = 1;

if (p > n)
{
nlopt_stop_msg(stop, "slsqp: more equality constraints than variables");
return NLOPT_INVALID_ARGS;
}

max_cdim = MAX2(nlopt_max_constraint_dim(m, fc),
nlopt_max_constraint_dim(p, h));
length_work(&len_w, &len_jw, mpi, pi, ni);
Expand Down

0 comments on commit 650b84f

Please sign in to comment.