Skip to content

Commit 81cd805

Browse files
committed
Use byteslice because string scanner position is in bytes not chars.
1 parent 9f9cafd commit 81cd805

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/truffle/strscan.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def peep(len)
340340
end
341341

342342
private def scan_internal_string_pattern(pattern, headonly)
343-
if @string[pos..].start_with?(pattern)
343+
if @string.byteslice(pos..).start_with?(pattern)
344344
Primitive.matchdata_create_single_group(pattern, @string.dup, 0, pattern.bytesize)
345345
else
346346
nil

0 commit comments

Comments
 (0)