Skip to content

Commit c3d6e02

Browse files
committed
Ensure proper path component types during refinement processing
A self-declared refinement processing "hack" fails, in certain situations, to re-verify that path components accessed in refinement processing are words before using word-specific accessor functions on them. Without this fix (example as reported by Sunanda in CC#1977): >> a: func [/b] [1] >> a/b/% ;; R3 crashes at this point. With this fix: >> a/b/% ** Script error: incompatible refinement: %"" This patch is a slight variation of an earlier fix written by Shixin Zeng (zsx/r3@72b5d98). This fixes CureCode issue #1977.
1 parent 25033f8 commit c3d6e02

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/c-do.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,10 @@ x*/ static REBINT Do_Args_Light(REBVAL *func, REBVAL *path, REBSER *block, REBCN
739739
}
740740

741741
// Hack to process remaining path:
742-
if (path && NOT_END(path)) goto more_path;
743-
// Trap2(RE_NO_REFINE, Func_Word(dsf), path);
742+
if (path && NOT_END(path)) {
743+
if (!IS_WORD(path)) Trap1(RE_BAD_REFINE, path);
744+
goto more_path;
745+
}
744746

745747
return index;
746748
}

0 commit comments

Comments
 (0)