* Bug #13780 fixed - size with two input and output arguments did not return an error.
+* Bug #13843 fixed - Scilab crashed when polarplot and plot2d were called with wrong strf value.
+
* Bug #13872 fixed - Non regression test added for unique function (the indices returned were wrong)
* Bug #14020 fixed - Incorrect carriage return ascii code.
char* pstData = NULL;
getVarAddressFromPosition(_pvCtx, pos, &piAddr);
getVarType(_pvCtx, piAddr, &iType);
-
- if (iType)
+ if (iType != 10)
{
- getAllocatedSingleString(_pvCtx, piAddr, &pstData);
- if ((int)strlen(pstData) != 3)
- {
- freeAllocatedSingleString(pstData);
- Scierror(999, _("%s: Wrong size for input argument #%d: String of %d characters expected.\n"), fname, pos, 3);
- return 0;
- }
- *strf = pstData;
+ Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, pos);
+ return 0;
}
- else
+
+ getAllocatedSingleString(_pvCtx, piAddr, &pstData);
+ if ((int)strlen(pstData) != 3)
{
- /* def value can be changed */
- reinitDefStrf();
- *strf = getDefStrf();
+ freeAllocatedSingleString(pstData);
+ Scierror(999, _("%s: Wrong size for input argument #%d: String of %d characters expected.\n"), fname, pos, 3);
+ return 0;
}
+ *strf = pstData;
}
else if ((kopt = FindOpt(_pvCtx, "strf", opts)) >= 0)
{
char* pstData = NULL;
+ int iType = 0;
+ getVarType(_pvCtx, opts[kopt].piAddr, &iType);
+ if (iType != 10)
+ {
+ Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, pos);
+ return 0;
+ }
+
getAllocatedSingleString(_pvCtx, opts[kopt].piAddr, &pstData);
if ((int)strlen(pstData) != 3)
{
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2015 - Scilab Enterprises - Charlotte Hecquet
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- TEST WITH GRAPHIC -->
+// <-- Non-regression test for bug 13843 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/13843
+//
+// <-- Short Description -->
+// plot2d and polarplot crashes Scilab with wrong strf argument
+// plot2d
+f = scf();
+x = linspace(0,10,100);
+errmsg = msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"), "plot2d", 4);
+assert_checkerror("plot2d(x, sin(x),1, 111);", errmsg);
+// polarplot
+clf();
+t = 0:.01:2*%pi;
+assert_checkerror("polarplot(sin(7*t),cos(8*t), [2 3], 111);", errmsg);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2015 - Scilab Enterprises - Charlotte Hecquet
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+
+// <-- Non-regression test for bug 13843 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/13843
+//
+// <-- Short Description -->
+// plot2d and polarplot crashes Scilab with wrong strf argument
+
+// plot2d
+f = scf();
+x = linspace(0,10,100);
+errmsg = msprintf(gettext("%s: Wrong type for input argument #%d: String expected.\n"), "plot2d", 4);
+assert_checkerror("plot2d(x, sin(x),1, 111);", errmsg);
+
+// polarplot
+clf();
+t = 0:.01:2*%pi;
+assert_checkerror("polarplot(sin(7*t),cos(8*t), [2 3], 111);", errmsg);