aboutsummaryrefslogtreecommitdiffstats
path: root/main/slang/fix-slarray-32bit.patch
blob: b8189c5562c20ae9a38b5c63f138e3d160b5b6e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Upstream: no idea. Patch from upstream mailing list.
Reason: src/test/array.sl fails on 32bit archs:
Testing array functions ...Unable to create a multi-dimensional array of the desired size
./array.sl:166:<top-level>:Invalid Parameter
URL: http://lists.jedsoft.org/lists/slang-users/2019/0000002.html

--- a/src/slarray.c
+++ b/src/slarray.c
@@ -369,7 +369,9 @@
 	SLindex_Type new_num_elements;
 	at->dims[i] = dims[i];
 	new_num_elements = dims[i] * num_elements;
-	if (dims[i] && (new_num_elements/dims[i] != num_elements))
+	if (dims[i]
+       && ((new_num_elements/dims[i] != num_elements)
+       || (new_num_elements < 0)))
 	  {
 	     throw_size_error (SL_Index_Error);
 	     free_array (at);