| ... | ... | @@ -702,8 +702,22 @@ test "empty distance alphabet" { |
| 702 | 702 | |
| 703 | 703 | test "inflateStream fuzzing" { |
| 704 | 704 | // see https://github.com/ziglang/zig/issues/9842 |
| 705 | | try std.testing.expectError(error.EndOfStream, testInflate("\x950000")); |
| 705 | try std.testing.expectError(error.EndOfStream, testInflate("\x95\x90=o\xc20\x10\x86\xf30")); |
| 706 | 706 | try std.testing.expectError(error.OutOfCodes, testInflate("\x950\x00\x0000000")); |
| 707 | |
| 708 | // Huffman.construct errors |
| 709 | // lencode |
| 710 | try std.testing.expectError(error.InvalidTree, testInflate("\x950000")); |
| 711 | try std.testing.expectError(error.InvalidTree, testInflate("\x05000")); |
| 712 | // hlen |
| 713 | try std.testing.expectError(error.InvalidTree, testInflate("\x05\xea\x01\t\x00\x00\x00\x01\x00\\\xbf.\t\x00")); |
| 714 | // hdist |
| 715 | try std.testing.expectError(error.InvalidTree, testInflate("\x05\xe0\x01A\x00\x00\x00\x00\x10\\\xbf.")); |
| 716 | |
| 717 | // Huffman.construct -> error.IncompleteSet returns that shouldn't give error.InvalidTree |
| 718 | // (like the "empty distance alphabet" test but for ndist instead of nlen) |
| 719 | try std.testing.expectError(error.EndOfStream, testInflate("\x05\xe0\x01\t\x00\x00\x00\x00\x10\\\xbf\xce")); |
| 720 | try testInflate("\x15\xe0\x01\t\x00\x00\x00\x00\x10\\\xbf.0"); |
| 707 | 721 | } |
| 708 | 722 | |
| 709 | 723 | fn testInflate(data: []const u8) !void { |