* [#15228](http://bugzilla.scilab.org/show_bug.cgi?id=15228): `get` error message fixed
* [#15239](http://bugzilla.scilab.org/show_bug.cgi?id=15239): The console's properties .tag and .userdata were not displayed nor documented.
* [#15236](http://bugzilla.scilab.org/show_bug.cgi?id=15236): The `isglobal` help page was inaccurate. Examples were erroneous.
+* [#15243](http://bugzilla.scilab.org/show_bug.cgi?id=15243): `grand(nr, nc, "uin", vmin)` crashed Scilab.
* [#15249](http://bugzilla.scilab.org/show_bug.cgi?id=15249): `findobj("toto")` yielded an error instead of returning [].
* [#15260](http://bugzilla.scilab.org/show_bug.cgi?id=15260): `sci2exp` was broken for cells, structures, and all types of hypermatrix.
* [#15266](http://bugzilla.scilab.org/show_bug.cgi?id=15266): Wrong default out_mode in `linear_interpn`.
}
}
+
if (pStrMethod == NULL)
{
for (int i = 0; i < in.size(); i++)
itab[1] = 1;
wchar_t* wcsMeth = pStrMethod->get(0);
- int iNumInputArg = 5;
+ int iNumInputArg = 2;
if (wcscmp(wcsMeth, L"bet") == 0) // beta
{
meth = 1;
}
else if (wcscmp(wcsMeth, L"chi") == 0) // chisquare
{
- iNumInputArg = 4;
+ iNumInputArg = 1;
meth = 4;
}
else if (wcscmp(wcsMeth, L"nch") == 0) // non central chisquare
}
else if (wcscmp(wcsMeth, L"exp") == 0) // exponential
{
- iNumInputArg = 4;
+ iNumInputArg = 1;
meth = 6;
}
else if (wcscmp(wcsMeth, L"f") == 0) // F variance ratio
}
else if (wcscmp(wcsMeth, L"nf") == 0) // non central F variance ratio
{
- iNumInputArg = 6;
+ iNumInputArg = 3;
meth = 8;
}
else if (wcscmp(wcsMeth, L"gam") == 0) // gamma
}
else if (wcscmp(wcsMeth, L"mn") == 0) // multivariate gaussian (multivariate normal)
{
- iNumInputArg = 4;
+ iNumInputArg = 2;
meth = 11;
}
else if (wcscmp(wcsMeth, L"geom") == 0) // geometric
{
- iNumInputArg = 4;
+ iNumInputArg = 1;
meth = 12;
}
else if (wcscmp(wcsMeth, L"markov") == 0) // markov
{
- iNumInputArg = 4;
+ iNumInputArg = 2;
meth = 13;
}
else if (wcscmp(wcsMeth, L"mul") == 0) // multinomial
{
- iNumInputArg = 4;
+ iNumInputArg = 2;
meth = 14;
}
else if (wcscmp(wcsMeth, L"poi") == 0) // Poisson
{
- iNumInputArg = 4;
+ iNumInputArg = 1;
meth = 15;
}
else if (wcscmp(wcsMeth, L"prm") == 0) // random permutations
{
- iNumInputArg = 3;
+ iNumInputArg = 1;
meth = 16;
}
else if (wcscmp(wcsMeth, L"def") == 0) // uniform (def)
{
- iNumInputArg = 3;
+ iNumInputArg = 0;
meth = 17;
}
else if (wcscmp(wcsMeth, L"unf") == 0) // uniform (unf)
}
else if (wcscmp(wcsMeth, L"lgi") == 0) // uniform (lgi)
{
- iNumInputArg = 3;
+ iNumInputArg = 0;
meth = 20;
}
else if (wcscmp(wcsMeth, L"getgen") == 0) // getgen
{
- iNumInputArg = 1;
+ iNumInputArg = 0;
meth = 21;
}
else if (wcscmp(wcsMeth, L"setgen") == 0) // setgen
{
- iNumInputArg = 2;
+ iNumInputArg = 1;
meth = 22;
}
else if (wcscmp(wcsMeth, L"getsd") == 0) // getsd
{
- iNumInputArg = 1;
+ iNumInputArg = 0;
meth = 23;
}
else if (wcscmp(wcsMeth, L"setsd") == 0) // setsd
switch (current_base_gen)
{
case MT:
- iNumInputArg = 2;
+ iNumInputArg = 1;
break;
case KISS:
- iNumInputArg = 5;
+ iNumInputArg = 4;
break;
case CLCG2:
- iNumInputArg = 3;
+ iNumInputArg = 2;
break;
case CLCG4:
- iNumInputArg = 5;
+ iNumInputArg = 4;
break;
case URAND:
- iNumInputArg = 2;
+ iNumInputArg = 1;
break;
}
meth = 24;
}
else if (wcscmp(wcsMeth, L"phr2sd") == 0) // phr2sd
{
- iNumInputArg = 2;
+ iNumInputArg = 1;
meth = 25;
}
else if (wcscmp(wcsMeth, L"setcgn") == 0) // setcgn
{
- iNumInputArg = 2;
+ iNumInputArg = 1;
meth = 26;
}
else if (wcscmp(wcsMeth, L"getcgn") == 0) // getcgn
{
- iNumInputArg = 1;
+ iNumInputArg = 0;
meth = 27;
}
else if (wcscmp(wcsMeth, L"initgn") == 0) // initgn
{
- iNumInputArg = 2;
+ iNumInputArg = 1;
meth = 28;
}
else if (wcscmp(wcsMeth, L"setall") == 0) // setall
{
- iNumInputArg = 5;
+ iNumInputArg = 4;
meth = 29;
}
else if (wcscmp(wcsMeth, L"advnst") == 0) // advnst
{
- iNumInputArg = 2;
+ iNumInputArg = 1;
meth = 30;
}
else
}
else
{
+ if (in.size() - iPos != iNumInputArg)
+ {
+ Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), "grand", iPos + iNumInputArg);
+ delete[] itab;
+ return types::Function::Error;
+ }
for (int i = iPos; i < in.size(); i++)
{
{
for (int i = 0; i < pOut[0]->getAs<U>()->getSize(); i++)
{
- pOut[0]->getAs<U>()->set(i , pIn->get(static_cast<int>(pDblOut->get(i))));
+ pOut[0]->getAs<U>()->set(i, pIn->get(static_cast<int>(pDblOut->get(i))));
pOut[0]->getAs<U>()->setImg(i, pIn->getImg(static_cast<int>(pDblOut->get(i))));
}
}
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2017 - ESI Group - Clement DAVID
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- ENGLISH IMPOSED -->
+// <-- NO CHECK REF -->
+//
+// <-- Non-regression test for bug 15243 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=15243
+//
+// <-- Short Description -->
+// grand() crashed with wrong number of arguments
+
+assert_checkerror("grand(3, 4, ""uin"", 0.9)", _("grand: Wrong number of input argument(s): 5 expected."));
+