From 5d1f855a2c560a2fc10a05ce9cb59e0865e8bff4 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Sun, 31 May 2026 18:13:34 -0700 Subject: [PATCH] fix another case --- ...00000,time:1399,execs:755,op:quick,pos:149 | 31 +++++++++++++++++++ test.zig | 1 + yaml.zig | 3 +- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 fuzz/crashes/id:000000,sig:06,src:000000,time:1399,execs:755,op:quick,pos:149 diff --git a/fuzz/crashes/id:000000,sig:06,src:000000,time:1399,execs:755,op:quick,pos:149 b/fuzz/crashes/id:000000,sig:06,src:000000,time:1399,execs:755,op:quick,pos:149 new file mode 100644 index 0000000000000000000000000000000000000000..878b4a244dfeec41d2461fde21d0129ca5041a0b --- /dev/null +++ b/fuzz/crashes/id:000000,sig:06,src:000000,time:1399,execs:755,op:quick,pos:149 @@ -0,0 +1,31 @@ +id: g982zq6e8wsvnmduerpbf8787hu85brugmngn8wf +name: yaml +main: yaml.zig +license: MIT +description: A Yaml parser built on top of libyaml +dependencies: +a - src: git https://github.com/yaml/libyaml tag-0.2.5 + id: 8mdbh0zuneb0i3hs5jby5je0heem1i6yxusl7c8y8qx68hqc + license: MIT + c_include_dirs: + - include + c_source_flags: + - -DYAML_VERSION_MAJOR=0 + - -DYAML_VERSION_MINOR=2 + - -DYAML_VERSION_PATCH=5 + - -DYAML_VERSION_STRING="0.2.5" + - -DYAML_DECLARE_STATIC=1 + c_source_files: + - src/api.c + - src/dumper.c + - src/emitter.c + - src/loader.c + - src/parser.c + - src/reader.c + - src/scanner.c + - src/writer.c + + - src: git https://github.com/nektro/zig-extras + +root_dependencies: + - src: git https://github.com/nektro/zig-expect diff --git a/test.zig b/test.zig index 8823cb5baedfc45679a3c02db0a7b2621827b8d5..dbbef136705d6069d0a2f3155c8bec2b0e1632d9 100644 --- a/test.zig +++ b/test.zig @@ -22,6 +22,7 @@ fn fuzzCase(embedfile_content: []const u8) void { test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:2049,execs:911,op:quick,pos:263")); } test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:6342,execs:4701,op:arith8,pos:55,val:+3")); } test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:1310,execs:717,op:quick,pos:97")); } +test { fuzzCase(@embedFile("./fuzz/crashes/id:000000,sig:06,src:000000,time:1399,execs:755,op:quick,pos:149")); } // zig fmt: on fn parseTest(comptime basename: [:0]const u8) !void { diff --git a/yaml.zig b/yaml.zig index cfe04ed8f6909d2f872ad92c08f40389581ea525..7f87d1be7a2c6f70565ea8fe670b311dd3bf06ec 100644 --- a/yaml.zig +++ b/yaml.zig @@ -376,8 +376,7 @@ fn get_event_string(event: Token, p: *const Parser) ![:0]u8 { const lines = p.lines; if (sm.line != em.line) { const starter = lines[sm.line][sm.column..]; - if (starter.len > 1 and starter[0] == '"') return error.YamlInvalidMultilineString; - std.debug.assert(starter.len == 1); + if (starter.len != 1) return error.YamlInvalidMultilineString; switch (starter[0]) { '|' => { var list = std.ArrayList(u8).init(p.alloc); -- 2.54.0