authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-05-31 03:25:22 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2024-05-31 03:25:22 -07:00
log7bed747a68aa7969649bb070c98042a699978b18
treed8d8f25927cda658c653984fd22e0826bee0e2b3
parent84fbe4db83738537df46119a31a806874f098240

fix crash appending codepoint to string

266/284 tests passed; 18 failed

1 files changed, 3 insertions(+), 1 deletions(-)

json.zig+3-1
...@@ -134,7 +134,9 @@ fn parseString(alloc: std.mem.Allocator, p: *Parser) anyerror!?StringIndex {...@@ -134,7 +134,9 @@ fn parseString(alloc: std.mem.Allocator, p: *Parser) anyerror!?StringIndex {
134 break;134 break;
135 }135 }
136 if (c != '\\') {136 if (c != '\\') {
137 try characters.append(@intCast(c));137 const l = std.unicode.utf8CodepointSequenceLength(c) catch unreachable;
138 const b = p.temp.items[p.idx - l ..][0..l];
139 try characters.appendSlice(b);
138 continue;140 continue;
139 }141 }
140 switch (try p.shift()) {142 switch (try p.shift()) {