authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-31 18:04:27 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-31 18:04:27 -07:00
loge145a883400796f2338f80c102f739fa8589d14a
tree5de8acae77a5ff2628fe2979baddcd6b47acfef8
parent7fcd3354080eb997c2b50b48f4e331b44d9624f1
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

fix another case


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

fuzz/crashes/id:000000,sig:06,src:000000,time:6342,execs:4701,op:arith8,pos:55,val:+3 created+30
...@@ -0,0 +1,30 @@
1id: g982zq6e8wsvnmduerpbf8787hu85brugmngn8wf
2name: yaml main: yaml.zig
3license: MIT
4description: A Yaml parser built on top of libyaml
5dependencies:
6 - src: git https://github.com/yaml/libyaml tag-0.2.5
7 id: 8mdbh0zuneb0i3hs5jby5je0heem1i6yxusl7c8y8qx68hqc
8 license: MIT
9 c_include_dirs:
10 - include
11 c_source_flags:
12 - -DYAML_VERSION_MAJOR=0
13 - -DYAML_VERSION_MINOR=2
14 - -DYAML_VERSION_PATCH=5
15 - -DYAML_VERSION_STRING="0.2.5"
16 - -DYAML_DECLARE_STATIC=1
17 c_source_files:
18 - src/api.c
19 - src/dumper.c
20 - src/emitter.c
21 - src/loader.c
22 - src/parser.c
23 - src/reader.c
24 - src/scanner.c
25 - src/writer.c
26
27 - src: git https://github.com/nektro/zig-extras
28
29root_dependencies:
30 - src: git https://github.com/nektro/zig-expect
test.zig+1
...@@ -20,6 +20,7 @@ fn fuzzCase(embedfile_content: []const u8) void {...@@ -20,6 +20,7 @@ fn fuzzCase(embedfile_content: []const u8) void {
2020
21// zig fmt: off21// zig fmt: off
22test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:2049,execs:911,op:quick,pos:263")); }22test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:2049,execs:911,op:quick,pos:263")); }
23test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:6342,execs:4701,op:arith8,pos:55,val:+3")); }
23// zig fmt: on24// zig fmt: on
2425
25fn parseTest(comptime basename: [:0]const u8) !void {26fn parseTest(comptime basename: [:0]const u8) !void {
yaml.zig+3-3
...@@ -212,7 +212,7 @@ pub fn parse(alloc: std.mem.Allocator, input: string) !Document {...@@ -212,7 +212,7 @@ pub fn parse(alloc: std.mem.Allocator, input: string) !Document {
212 _ = c.yaml_parser_initialize(&parser);212 _ = c.yaml_parser_initialize(&parser);
213 defer c.yaml_parser_delete(&parser);213 defer c.yaml_parser_delete(&parser);
214214
215 const lines = try split(alloc, input, '\n');215 const lines = try split(alloc, input);
216 defer alloc.free(lines);216 defer alloc.free(lines);
217217
218 _ = c.yaml_parser_set_input_string(&parser, input.ptr, input.len);218 _ = c.yaml_parser_set_input_string(&parser, input.ptr, input.len);
...@@ -401,11 +401,11 @@ fn get_event_string(event: Token, p: *const Parser) ![:0]u8 {...@@ -401,11 +401,11 @@ fn get_event_string(event: Token, p: *const Parser) ![:0]u8 {
401//401//
402//402//
403403
404fn split(alloc: std.mem.Allocator, in: string, delim: u8) ![]string {404fn split(alloc: std.mem.Allocator, in: string) ![]string {
405 var list = std.ArrayList(string).init(alloc);405 var list = std.ArrayList(string).init(alloc);
406 errdefer list.deinit();406 errdefer list.deinit();
407407
408 var iter = std.mem.splitScalar(u8, in, delim);408 var iter = std.mem.splitAny(u8, in, "\r\n");
409 while (iter.next()) |str| {409 while (iter.next()) |str| {
410 try list.append(str);410 try list.append(str);
411 }411 }