File tree 4 files changed +10
-2
lines changed
4 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 593
593
594
594
// Accept ^X encoded char:
595
595
else if (c == '^' ) {
596
- if (src + 1 == end ) return 0 ; // nothing follows ^
596
+ // checks also if not used in file like: %a^b which must be invalid!
597
+ if (src + 1 == end || (invalid && strchr (cs_cast (invalid ), c )))
598
+ return 0 ; // nothing follows ^ or used in unquoted file
597
599
c = Scan_Char (& src );
598
600
if (!term && IS_WHITE (c )) break ;
599
601
src -- ;
Original file line number Diff line number Diff line change @@ -648,7 +648,7 @@ bad_hex: Trap0(RE_INVALID_CHARS);
648
648
***********************************************************************/
649
649
{
650
650
REBUNI term = 0 ;
651
- const REBYTE * invalid = cb_cast (":;()[]\"" );
651
+ const REBYTE * invalid = cb_cast (":;()[]\"^ " );
652
652
653
653
if (* cp == '%' ) cp ++ , len -- ;
654
654
if (* cp == '"' ) {
Original file line number Diff line number Diff line change @@ -82,6 +82,9 @@ Rebol [
82
82
--test-- "Invalid file"
83
83
;@@ https://github.com/Oldes/Rebol-issues/issues/1415
84
84
--assert all [error? e: try [load {%^^ } ] e/id = 'invalid]
85
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/1442
86
+ --assert all [error? e: try [load {%a^^ b} ] e/id = 'invalid]
87
+ --assert all [error? e: try [load {%a^^ } ] e/id = 'invalid]
85
88
86
89
===end-group===
87
90
Original file line number Diff line number Diff line change @@ -213,6 +213,9 @@ Rebol [
213
213
]
214
214
;@@ https://github.com/Oldes/Rebol-issues/issues/1415
215
215
--assert "%%5E" == mold to-file "^^ "
216
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/1442
217
+ --assert "%a%02c" == mold to-file "a^B c"
218
+ --assert "%a%20b" == mold to-file "a^ b"
216
219
217
220
===end-group===
218
221
You can’t perform that action at this time.
0 commit comments