Fix string scan bug

This commit is contained in:
2025-06-22 23:01:08 -04:00
parent 95250d1668
commit fc1b3ac147

View File

@@ -788,18 +788,20 @@ inline PRESERVE_NONE WeaselJsonStatus scan_string_impl(Parser3 *self,
char *bufEnd) { char *bufEnd) {
const auto before = buf; const auto before = buf;
// Advance buf past normal characters // Advance buf past characters that transition the accept state to itself
for (;;) { if (self->strDfa.accept()) {
if (bufEnd - buf < V::lanes) [[unlikely]] { for (;;) {
break; if (bufEnd - buf < V::lanes) [[unlikely]] {
} break;
auto v = V{(int8_t *)buf}; }
int normal = auto v = V{(int8_t *)buf};
(v != V::splat('"') & v != V::splat('\\') & v >= V::splat(0x20)) int normal =
.count_leading_nonzero_lanes(); (v != V::splat('"') & v != V::splat('\\') & v >= V::splat(0x20))
buf += normal; .count_leading_nonzero_lanes();
if (normal < V::lanes) { buf += normal;
break; if (normal < V::lanes) {
break;
}
} }
} }