fix: parse_literal_string() properly issues invalid-utf8 errors

When creating the inner iterator, make sure it points into the same
vector as the outer iterator.  Otherwise, attempts to reset the iterator
wind up causing it to read out-of-bounds.

Fixes #199.
This commit is contained in:
Chris White
2023-01-14 18:09:05 -05:00
parent 22db720ad5
commit e3639d2bbc

View File

@@ -664,7 +664,8 @@ parse_literal_string(location& loc)
const auto first = loc.iter();
if(const auto token = lex_literal_string::invoke(loc))
{
location inner_loc(loc.name(), token.unwrap().str());
auto inner_loc = loc;
inner_loc.reset(first);
const auto open = lex_apostrophe::invoke(inner_loc);
if(!open)