| author | |
| committer | |
| log | 74a41951e6b4957415868983ed24338256176457 |
| tree | 499bdaefcd4b597371ca306d21779baf985d4bfd |
| parent | d7457589a5d85d3005e6e2dfc0748bb704e82bbb |
| signature |
3 files changed, 41 insertions(+), 0 deletions(-)
fuzz/crashes/id:000000,sig:06,src:000000,time:16058,execs:7921,op:arith8,pos:522,val:+10 created+31| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | id: g982zq6e8wsvnmduerpbf8787hu85brugmngn8wf | |
| 2 | name: yaml | |
| 3 | main: yaml.zig | |
| 4 | license: MIT | |
| 5 | description: A Yaml parser built on top of libyaml | |
| 6 | dependencies: | |
| 7 | - src: git https://github.com/yaml/libyaml tag-0.2.5 | |
| 8 | id: 8mdbh0zuneb0i3hs5jby5je0heem1i6yxusl7c8y8qx68hqc | |
| 9 | license: MIT | |
| 10 | c_include_dirs: | |
| 11 | - include | |
| 12 | c_source_flags: | |
| 13 | - -DYAML_VERSION_MAJOR=0 | |
| 14 | - -DYAML_VERSION_MINOR=2 | |
| 15 | - -DYAML_VERSION_PATCH=5 | |
| 16 | - -DYAML_VERSION_STRING="0.2.5" | |
| 17 | - -DYAML_DECLARE_STATIC=1 | |
| 18 | c_source_files: | |
| 19 | *- src/api.c | |
| 20 | - src/dumper.c | |
| 21 | - src/emitter.c | |
| 22 | - src/loader.c | |
| 23 | - src/parser.c | |
| 24 | - src/reader.c | |
| 25 | - src/scanner.c | |
| 26 | - src/writer.c | |
| 27 | ||
| 28 | - src: git https://github.com/nektro/zig-extras | |
| 29 | ||
| 30 | root_dependencies: | |
| 31 | - src: git https://github.com/nektro/zig-expect |
test.zig+1| ... | ... | @@ -24,6 +24,7 @@ test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:6342 |
| 24 | 24 | test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:1310,execs:717,op:quick,pos:97")); } |
| 25 | 25 | test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:1399,execs:755,op:quick,pos:149")); } |
| 26 | 26 | test { fuzzCase(@embedFile("./fuzz/crashes/id:000002,sig:06,src:000000,time:12249,execs:9637,op:int8,pos:0,val:+32")); } |
| 27 | test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:16058,execs:7921,op:arith8,pos:522,val:+10")); } | |
| 27 | 28 | // zig fmt: on |
| 28 | 29 | |
| 29 | 30 | fn parseTest(comptime basename: [:0]const u8) !void { |
yaml.zig+9| ... | ... | @@ -39,6 +39,7 @@ pub const Item = union(enum) { |
| 39 | 39 | sequence: Sequence, |
| 40 | 40 | string: [:0]const u8, |
| 41 | 41 | stream: Stream, |
| 42 | anchor: [:0]const u8, | |
| 42 | 43 | |
| 43 | 44 | pub fn deinit(self: *const Item, alloc: std.mem.Allocator) void { |
| 44 | 45 | switch (self.*) { |
| ... | ... | @@ -51,6 +52,7 @@ pub const Item = union(enum) { |
| 51 | 52 | }, |
| 52 | 53 | .string => |s| alloc.free(s), |
| 53 | 54 | .stream => |s| s.deinit(alloc), |
| 55 | .anchor => {}, | |
| 54 | 56 | } |
| 55 | 57 | } |
| 56 | 58 | |
| ... | ... | @@ -76,6 +78,9 @@ pub const Item = union(enum) { |
| 76 | 78 | .string => { |
| 77 | 79 | try writer.print("{s}", .{self.string}); |
| 78 | 80 | }, |
| 81 | .anchor => { | |
| 82 | // | |
| 83 | }, | |
| 79 | 84 | } |
| 80 | 85 | try writer.writeAll("}"); |
| 81 | 86 | } |
| ... | ... | @@ -97,6 +102,7 @@ pub const Value = union(enum) { |
| 97 | 102 | string: [:0]const u8, |
| 98 | 103 | mapping: Mapping, |
| 99 | 104 | sequence: Sequence, |
| 105 | anchor: [:0]const u8, | |
| 100 | 106 | |
| 101 | 107 | pub fn deinit(self: *const Value, alloc: std.mem.Allocator) void { |
| 102 | 108 | switch (self.*) { |
| ... | ... | @@ -108,6 +114,7 @@ pub const Value = union(enum) { |
| 108 | 114 | for (s) |*item| item.deinit(alloc); |
| 109 | 115 | alloc.free(s); |
| 110 | 116 | }, |
| 117 | .anchor => {}, | |
| 111 | 118 | } |
| 112 | 119 | } |
| 113 | 120 | |
| ... | ... | @@ -268,6 +275,7 @@ fn parse_item(p: *Parser, start: ?Token) Error!Item { |
| 268 | 275 | c.YAML_MAPPING_START_EVENT => Item{ .mapping = try parse_mapping(p) }, |
| 269 | 276 | c.YAML_SEQUENCE_START_EVENT => Item{ .sequence = try parse_sequence(p) }, |
| 270 | 277 | c.YAML_SCALAR_EVENT => Item{ .string = try get_event_string(tok, p) }, |
| 278 | c.YAML_ALIAS_EVENT => .{ .anchor = std.mem.sliceTo(tok.data.alias.anchor, 0) }, | |
| 271 | 279 | else => unreachable, |
| 272 | 280 | }; |
| 273 | 281 | } |
| ... | ... | @@ -344,6 +352,7 @@ fn parse_value(p: *Parser) Error!Value { |
| 344 | 352 | .mapping => |x| Value{ .mapping = x }, |
| 345 | 353 | .sequence => |x| Value{ .sequence = x }, |
| 346 | 354 | .string => |x| Value{ .string = x }, |
| 355 | .anchor => |x| Value{ .anchor = x }, | |
| 347 | 356 | else => unreachable, |
| 348 | 357 | }; |
| 349 | 358 | } |