| author | |
| committer | |
| log | b81a9ced5fceadce93207c59434e5905de3efba8 |
| tree | becfad7ecbe872147223ab15ecd8b7be07385279 |
| parent | 7306ea63fbf1d83b3ba8df1822a55d2e859997ab |
| signature |
3 files changed, 39 insertions(+), 0 deletions(-)
fuzz/crashes/id:000000,sig:06,src:000000,time:2049,execs:911,op:quick,pos:263 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 | J 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+5| ... | @@ -11,6 +11,11 @@ test { | ... | @@ -11,6 +11,11 @@ test { |
| 11 | 11 | ||
| 12 | try expect(doc.mapping.get_string("id").?).toEqualString("g982zq6e8wsvnmduerpbf8787hu85brugmngn8wf"); | 12 | try expect(doc.mapping.get_string("id").?).toEqualString("g982zq6e8wsvnmduerpbf8787hu85brugmngn8wf"); |
| 13 | } | 13 | } |
| 14 | test { | ||
| 15 | const alloc = std.testing.allocator; | ||
| 16 | const doc = yaml.parse(alloc, @embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:2049,execs:911,op:quick,pos:263")) catch return; | ||
| 17 | defer doc.deinit(alloc); | ||
| 18 | } | ||
| 14 | 19 | ||
| 15 | fn parseTest(comptime basename: [:0]const u8) !void { | 20 | fn parseTest(comptime basename: [:0]const u8) !void { |
| 16 | const alloc = std.testing.allocator; | 21 | const alloc = std.testing.allocator; |
yaml.zig+3| ... | @@ -302,6 +302,7 @@ fn parse_document(p: *Parser) Error!Document { | ... | @@ -302,6 +302,7 @@ fn parse_document(p: *Parser) Error!Document { |
| 302 | switch (tok.type) { | 302 | switch (tok.type) { |
| 303 | c.YAML_MAPPING_START_EVENT => { | 303 | c.YAML_MAPPING_START_EVENT => { |
| 304 | const item = try parse_item(p, tok); | 304 | const item = try parse_item(p, tok); |
| 305 | errdefer item.deinit(p.alloc); | ||
| 305 | const tok2 = try p.next(); | 306 | const tok2 = try p.next(); |
| 306 | if (tok2.type != c.YAML_DOCUMENT_END_EVENT) { | 307 | if (tok2.type != c.YAML_DOCUMENT_END_EVENT) { |
| 307 | return error.YamlUnexpectedToken; | 308 | return error.YamlUnexpectedToken; |
| ... | @@ -310,6 +311,7 @@ fn parse_document(p: *Parser) Error!Document { | ... | @@ -310,6 +311,7 @@ fn parse_document(p: *Parser) Error!Document { |
| 310 | }, | 311 | }, |
| 311 | c.YAML_SEQUENCE_START_EVENT => { | 312 | c.YAML_SEQUENCE_START_EVENT => { |
| 312 | const item = try parse_item(p, tok); | 313 | const item = try parse_item(p, tok); |
| 314 | errdefer item.deinit(p.alloc); | ||
| 313 | const tok2 = try p.next(); | 315 | const tok2 = try p.next(); |
| 314 | if (tok2.type != c.YAML_DOCUMENT_END_EVENT) { | 316 | if (tok2.type != c.YAML_DOCUMENT_END_EVENT) { |
| 315 | return error.YamlUnexpectedToken; | 317 | return error.YamlUnexpectedToken; |
| ... | @@ -357,6 +359,7 @@ fn parse_value(p: *Parser) Error!Value { | ... | @@ -357,6 +359,7 @@ fn parse_value(p: *Parser) Error!Value { |
| 357 | fn parse_sequence(p: *Parser) Error!Sequence { | 359 | fn parse_sequence(p: *Parser) Error!Sequence { |
| 358 | var res = std.ArrayList(Item).init(p.alloc); | 360 | var res = std.ArrayList(Item).init(p.alloc); |
| 359 | errdefer res.deinit(); | 361 | errdefer res.deinit(); |
| 362 | errdefer for (res.items) |k| k.deinit(p.alloc); | ||
| 360 | 363 | ||
| 361 | while (true) { | 364 | while (true) { |
| 362 | const tok = try p.next(); | 365 | const tok = try p.next(); |