Skip to content

Commit 7c030cf

Browse files
committed
FIX: crash when composing large block
fixes: Oldes/Rebol-issues#1906
1 parent 6191f4f commit 7c030cf

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/core/c-do.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -1317,10 +1317,14 @@ x*/ static REBINT Do_Args_Light(REBVAL *func, REBVAL *path, REBSER *block, REBCN
13171317
**
13181318
***********************************************************************/
13191319
{
1320-
REBVAL *value;
1320+
REBVAL *value = VAL_BLK_DATA(block);
13211321
REBINT start = DSP + 1;
1322+
1323+
if (start + VAL_LEN(block) + 100 > SERIES_REST(DS_Series)) {
1324+
Expand_Stack(VAL_LEN(block));
1325+
}
13221326

1323-
for (value = VAL_BLK_DATA(block); NOT_END(value); value++) {
1327+
for (; NOT_END(value); value++) {
13241328
if (IS_PAREN(value)) {
13251329
// Eval the paren, and leave result on the stack:
13261330
DO_BLK(value);

src/tests/units/crash-test.r3

+5
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ Rebol [
151151
--assert #0102030405060708090A = to-hex/size 1.2.3.4.5.6.7.8.9.10 20
152152
--assert #0102030405 = to-hex/size 1.2.3.4.5.6.7.8.9.10 10
153153

154+
--test-- {compose large block}
155+
;@@ https://github.com/Oldes/Rebol-issues/issues/1906
156+
b: copy [] insert/dup b 1 32768
157+
--assert b = compose b ;- no crash
158+
154159
===end-group===
155160

156161
~~~end-file~~~

0 commit comments

Comments
 (0)