Raise SyntaxError on invalid UTF8 strings in lexer/tokenizer

This commit is contained in:
Chris AtLee
2025-02-11 14:23:15 -05:00
parent aec966eed7
commit 550135c0b9
5 changed files with 35 additions and 0 deletions
+6
View File
@@ -103,6 +103,12 @@ module Liquid
pos = @ss.pos -= 2
@source.byteslice(start, pos - start)
rescue ::ArgumentError => e
if e.message == "invalid byte sequence in #{@ss.string.encoding}"
raise SyntaxError, "Invalid byte sequence in #{@ss.string.encoding}"
else
raise
end
end
def next_variable_token