File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -323,8 +323,9 @@ load: function [
323
323
324
324
;-- Try to load the header, handle error:
325
325
not all [
326
- set [hdr: data: ] either object? data [load-ext-module data] [load-header data]
326
+ set [hdr: data: end: ] either object? data [load-ext-module data] [load-header data]
327
327
if word? hdr [cause-error 'syntax hdr source]
328
+ unless tail? end [data: copy/part data end]
328
329
]
329
330
; data is binary or block now, hdr is object or none
330
331
@@ -537,7 +538,8 @@ load-module: function [
537
538
; Get and process the header
538
539
not hdr [
539
540
; Only happens for string, binary or non-extension file/url source
540
- set [hdr: code: ] load-header/required data
541
+ set [hdr: code: end: ] load-header/required data
542
+ unless tail? end [code: copy/part code end]
541
543
case [
542
544
word? hdr [cause-error 'syntax hdr source]
543
545
import none ; /import overrides 'delay option
Original file line number Diff line number Diff line change @@ -60,6 +60,14 @@ Rebol [
60
60
--assert block? b: load ["print 'hello" "print 'there" ]
61
61
--assert [print 'hello] = b/1
62
62
--assert [print 'there] = b/2
63
+
64
+ --test-- "Length-specified script embedding"
65
+ ;@@ https://github.com/Oldes/Rebol-issues/issues/1941
66
+ --assert [print "hello" ] = load {rebol [length: 14] print "hello" other stuff}
67
+ --assert 1 = try [do {rebol [length: 2] 1 other stuff} ]
68
+ --assert [lib-local a] = words-of import {rebol [length: 5] a: 1 b: 2 print "evil code"}
69
+ --assert [lib-local a] = words-of import/check {rebol [length: 5 checksum: #{E9A16FDEC8FF093599E2AA10C30D2D98D1C541C5} ] a: 1 b: 2 print "evil code"} #{ E9A16FDEC8FF093599E2AA10C30D2D98D1C541C5 }
70
+
63
71
--test-- "issue-858"
64
72
;@@ https://github.com/Oldes/Rebol-issues/issues/858
65
73
--assert [< ] = load mold [ < ]
@@ -78,7 +86,6 @@ Rebol [
78
86
79
87
===end-group===
80
88
81
-
82
89
===start-group=== "find-script native"
83
90
--test-- "find-script"
84
91
;@@ https://github.com/Oldes/Rebol-issues/issues/182
You can’t perform that action at this time.
0 commit comments