| author | |
| committer | |
| log | e145a883400796f2338f80c102f739fa8589d14a |
| tree | 5de8acae77a5ff2628fe2979baddcd6b47acfef8 |
| parent | 7fcd3354080eb997c2b50b48f4e331b44d9624f1 |
| signature |
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 @@ | ||
| 1 | id: g982zq6e8wsvnmduerpbf8787hu85brugmngn8wf | ||
| 2 | name: yaml main: yaml.zig | ||
| 3 | license: MIT | ||
| 4 | description: A Yaml parser built on top of libyaml | ||
| 5 | dependencies: | ||
| 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 | |||
| 29 | root_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 { |
| 20 | 20 | ||
| 21 | // zig fmt: off | 21 | // zig fmt: off |
| 22 | test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:2049,execs:911,op:quick,pos:263")); } | 22 | test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:2049,execs:911,op:quick,pos:263")); } |
| 23 | test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:6342,execs:4701,op:arith8,pos:55,val:+3")); } | ||
| 23 | // zig fmt: on | 24 | // zig fmt: on |
| 24 | 25 | ||
| 25 | fn parseTest(comptime basename: [:0]const u8) !void { | 26 | fn 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); |
| 214 | 214 | ||
| 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); |
| 217 | 217 | ||
| 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 | // |
| 403 | 403 | ||
| 404 | fn split(alloc: std.mem.Allocator, in: string, delim: u8) ![]string { | 404 | fn 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(); |
| 407 | 407 | ||
| 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 | } |