summaryrefslogtreecommitdiffstats
path: root/scilab/modules/core
diff options
context:
space:
mode:
authorPierre MARECHAL <pierre.marechal@scilab.org>2010-04-22 10:30:55 +0200
committerPierre MARECHAL <pierre.marechal@scilab.org>2010-04-22 10:30:55 +0200
commite5c4db103d4d74b8c35146c25d8484a7a74c26a8 (patch)
treee3ec8d655e85dbbf0603110cdb48ab449a438511 /scilab/modules/core
parent9371b38f0b8cf0130c0d08d4b5e475ad1c121273 (diff)
parent469d891612dd9f60a1e3bed8c89abe48b7ece3a6 (diff)
downloadscilab-e5c4db103d4d74b8c35146c25d8484a7a74c26a8.zip
scilab-e5c4db103d4d74b8c35146c25d8484a7a74c26a8.tar.gz
Merge commit 'origin/hpc'
Diffstat (limited to 'scilab/modules/core')
-rw-r--r--scilab/modules/core/src/cpp/namstr.cpp7
-rw-r--r--scilab/modules/core/tests/nonreg_tests/bug_6931.dia.ref19
-rw-r--r--scilab/modules/core/tests/nonreg_tests/bug_6931.tst22
3 files changed, 45 insertions, 3 deletions
diff --git a/scilab/modules/core/src/cpp/namstr.cpp b/scilab/modules/core/src/cpp/namstr.cpp
index 3dba511..f681894 100644
--- a/scilab/modules/core/src/cpp/namstr.cpp
+++ b/scilab/modules/core/src/cpp/namstr.cpp
@@ -11,7 +11,7 @@
11 */ 11 */
12#include "machine.h" /* C2F */ 12#include "machine.h" /* C2F */
13#include "stack-def.h" /* nsiz, nlgh */ 13#include "stack-def.h" /* nsiz, nlgh */
14 14#include <algorithm>
15extern "C" 15extern "C"
16{ 16{
17 void C2F(namstr)(int* id, int* str, int* n, char* job); 17 void C2F(namstr)(int* id, int* str, int* n, char* job);
@@ -72,8 +72,9 @@ void C2F(namstr)(int* id,int* str, int* n, char* job)
72 { /* str -> id */ 72 { /* str -> id */
73 /* n (<= nsiz*4 = nlgh) int in str packed into id */ 73 /* n (<= nsiz*4 = nlgh) int in str packed into id */
74 unsigned int j; 74 unsigned int j;
75 /* a full id contains 4 ints from str, so we have *n/4 full ids the remaing are padded with blanks */ 75 /* a full id contains 4 ints from str, so we have *n/4 full ids the remaing are padded with blanks
76 unsigned const int full_ids((*n)/4); 76 we can get *n > nlgh (we truncate @ nsiz ids) */
77 unsigned const int full_ids(std::min(*n/4, nsiz));
77 78
78 for (j= 0; j!=full_ids; ++j) 79 for (j= 0; j!=full_ids; ++j)
79 { /* str int are signed bytes in fact, we pack them using shifts */ 80 { /* str int are signed bytes in fact, we pack them using shifts */
diff --git a/scilab/modules/core/tests/nonreg_tests/bug_6931.dia.ref b/scilab/modules/core/tests/nonreg_tests/bug_6931.dia.ref
new file mode 100644
index 0000000..1ca5236
--- /dev/null
+++ b/scilab/modules/core/tests/nonreg_tests/bug_6931.dia.ref
@@ -0,0 +1,19 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - DIGITEO - Bernard HUGUENEY
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7// <-- Non-regression test for bug 6931 -->
8//
9// <-- Bugzilla URL -->
10// http://bugzilla.scilab.org/show_bug.cgi?id=6931
11//
12// <-- Short Description -->
13// Crash when using a name with size > nlgh (=24)
14//
15A = '';
16for i=1:128
17 A=A+'t';
18 exists(sprintf('%s',A));
19end
diff --git a/scilab/modules/core/tests/nonreg_tests/bug_6931.tst b/scilab/modules/core/tests/nonreg_tests/bug_6931.tst
new file mode 100644
index 0000000..9d2194c
--- /dev/null
+++ b/scilab/modules/core/tests/nonreg_tests/bug_6931.tst
@@ -0,0 +1,22 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - DIGITEO - Bernard HUGUENEY
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7
8// <-- Non-regression test for bug 6931 -->
9//
10// <-- Bugzilla URL -->
11// http://bugzilla.scilab.org/show_bug.cgi?id=6931
12//
13// <-- Short Description -->
14// Crash when using a name with size > nlgh (=24)
15//
16
17A = '';
18for i=1:128
19 A=A+'t';
20 exists(sprintf('%s',A));
21end
22