diff --git a/src/algs/slsqp/slsqp.c b/src/algs/slsqp/slsqp.c index f572c8f1..d75f4a9b 100644 --- a/src/algs/slsqp/slsqp.c +++ b/src/algs/slsqp/slsqp.c @@ -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"); + ret = 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);