Skip to content

Commit

Permalink
FIX: crash when used protect/words/deep with block of values which ar…
Browse files Browse the repository at this point in the history
…e not series

fixes: Oldes/Rebol-issues#2417
  • Loading branch information
Oldes committed Apr 27, 2020
1 parent d378e7f commit e128def
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/n-control.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,10 @@ enum {
Protect_Word(wrd, flags);
if (GET_FLAG(flags, PROT_DEEP)) {
val = Get_Var(word);
Protect_Value(val, flags);
Unmark(val);
if(!IS_SCALAR(val)) {
Protect_Value(val, flags);
Unmark(val);
}
}
}
else if (ANY_PATH(word)) {
Expand Down
9 changes: 9 additions & 0 deletions src/tests/units/crash-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ Rebol [
;@@ https://github.com/Oldes/Rebol-issues/issues/261
--assert percent? p: to percent! to decimal! #{7FEFFFFFFFFFFFFF} ;- no crash
--assert #{7FEFFFFFFFFFFFFF} = to binary! to decimal! p

--test-- "issue-2417"
;@@ https://github.com/Oldes/Rebol-issues/issues/2417
--assert block? protect/words [aaaa]
--assert block? protect/words/deep [bbbb] ;- no crash
cccc: 1
dddd: 2
--assert block? protect/words [cccc]
--assert block? protect/words/deep [dddd] ;- no crash
===end-group===

~~~end-file~~~

0 comments on commit e128def

Please sign in to comment.