summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane MOTTELET <stephane.mottelet@utc.fr>2019-10-02 12:18:44 +0200
committerClément DAVID <clement.david@esi-group.com>2019-11-19 17:43:32 +0100
commitcea4414fb4690231f225773f29c88776c6dfa23a (patch)
tree48de8868f2f045a66410175898e19197e870268a
parent0fd9e8a7458c71da0f08536301ce05417a0e8e88 (diff)
downloadscilab-cea4414fb4690231f225773f29c88776c6dfa23a.zip
scilab-cea4414fb4690231f225773f29c88776c6dfa23a.tar.gz
* Bug 16209 fixed: grand(n,m,exp,1) may freeze Scilab with default generator
http://bugzilla.scilab.org/show_bug.cgi?id=16209 Change-Id: I11bb954a7a70d0d2862dba8dddc42d9dcada2fd0
-rw-r--r--scilab/CHANGES.md2
-rw-r--r--scilab/modules/randlib/src/c/sexpo.c1
-rw-r--r--scilab/modules/randlib/tests/nonreg_tests/bug_16209.tst22
3 files changed, 24 insertions, 1 deletions
diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md
index d0a2679..8df34ab 100644
--- a/scilab/CHANGES.md
+++ b/scilab/CHANGES.md
@@ -186,5 +186,5 @@ Bug Fixes
186* [#16144](http://bugzilla.scilab.org/show_bug.cgi?id=16144): Addition of sparse matrices gave incorrect results. 186* [#16144](http://bugzilla.scilab.org/show_bug.cgi?id=16144): Addition of sparse matrices gave incorrect results.
187* [#16174](http://bugzilla.scilab.org/show_bug.cgi?id=16174): `libraryinfo` yielded 0x0 matrix of strings for libs without macro 187* [#16174](http://bugzilla.scilab.org/show_bug.cgi?id=16174): `libraryinfo` yielded 0x0 matrix of strings for libs without macro
188* [#16208](http://bugzilla.scilab.org/show_bug.cgi?id=16208): Using 3D string matrix with old C-api gateways may crash Scilab. 188* [#16208](http://bugzilla.scilab.org/show_bug.cgi?id=16208): Using 3D string matrix with old C-api gateways may crash Scilab.
189 189* [#16209](http://bugzilla.scilab.org/show_bug.cgi?id=16209): grand() causes a freeze after several consecutive calls when using default base generator.
190 190
diff --git a/scilab/modules/randlib/src/c/sexpo.c b/scilab/modules/randlib/src/c/sexpo.c
index b96c03a..a385839 100644
--- a/scilab/modules/randlib/src/c/sexpo.c
+++ b/scilab/modules/randlib/src/c/sexpo.c
@@ -58,6 +58,7 @@ modifications done by JJV
58 58
59 a = 0.0; 59 a = 0.0;
60 u = C2F(ranf)(); 60 u = C2F(ranf)();
61 u = (u == 0.0) ? C2F(ranf)() : u;
61 goto S30; 62 goto S30;
62S20: 63S20:
63 a += q[0]; 64 a += q[0];
diff --git a/scilab/modules/randlib/tests/nonreg_tests/bug_16209.tst b/scilab/modules/randlib/tests/nonreg_tests/bug_16209.tst
new file mode 100644
index 0000000..38572a1
--- /dev/null
+++ b/scilab/modules/randlib/tests/nonreg_tests/bug_16209.tst
@@ -0,0 +1,22 @@
1// ===================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2019 - Stéphane MOTTELET
4//
5// This file is distributed under the same license as the Scilab package.
6// ===================================================================
7//
8// <-- CLI SHELL MODE -->
9// <-- NO CHECK REF -->
10//
11// <-- Non-regression test for bug 15840 -->
12//
13// <-- Bugzilla URL -->
14// http://bugzilla.scilab.org/16209
15//
16// <-- Short Description -->
17// grand() causes a freeze after several consecutive calls when using default base generator.
18
19for i=1:1858
20 grand(1,1e6,"exp",1)
21end
22grand(1,606052,"exp",1) \ No newline at end of file