diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9762b3b47..c6f34d49c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,7 +21,7 @@ jobs: matrix: os: [ubuntu-latest, macOS-latest, windows-latest] rustalias: [stable, nightly, msrv] - feature_flag: ["--all-features", "--no-default-features", ""] + feature_flag: ["--no-default-features --features sync_all", "--no-default-features --features tokio_all", "--no-default-features --features sync", "--no-default-features --features tokio", ""] include: - rustalias: stable rust: stable diff --git a/Cargo.toml b/Cargo.toml index 0e85fef24..29de3e387 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,25 @@ edition = "2021" exclude = ["tests/**", "examples/**", ".github/**", "fuzz/**"] build = "src/build.rs" +[package.metadata.docs.rs] +features = [ + "aes-crypto", + "bzip2", + "chrono", + "deflate", + "deflate64", + "deflate", + "deflate-zlib", + "deflate-zlib-ng", + "lzma", + "time", + "zstd", +] +# Can be enabled when is fixed +# all-features = true +no-default-features = true +rustdoc-args = ["--cfg", "docsrs"] + [workspace.dependencies] time = { version = "0.3.36", default-features = false } @@ -43,6 +62,8 @@ zstd = { version = "0.13.1", optional = true, default-features = false } zopfli = { version = "0.8.0", optional = true } deflate64 = { version = "0.1.8", optional = true } lzma-rs = { version = "0.3.0", default-features = false, optional = true } +true = { version = "0.1.0", optional = true } +tokio = { version = "1.37.0", optional = true } [target.'cfg(any(all(target_arch = "arm", target_pointer_width = "32"), target_arch = "mips", target_arch = "powerpc"))'.dependencies] crossbeam-utils = "0.8.19" @@ -68,11 +89,14 @@ deflate = ["flate2/rust_backend", "_deflate-any"] # DEPRECATED: previously enabled `flate2/miniz_oxide` which is equivalent to `flate2/rust_backend` deflate-miniz = ["deflate", "_deflate-any"] - deflate-zlib = ["flate2/zlib", "_deflate-any"] deflate-zlib-ng = ["flate2/zlib-ng", "_deflate-any"] deflate-zopfli = ["zopfli", "_deflate-any"] lzma = ["lzma-rs/stream"] +sync = [] +sync_all = ["aes-crypto", "chrono", "deflate", "deflate-miniz", "deflate-zlib", "deflate-zlib-ng", "deflate-zopfli", "lzma", "sync","time"] +tokio_all = ["aes-crypto", "chrono", "deflate", "deflate-miniz", "deflate-zlib", "deflate-zlib-ng", "deflate-zopfli", "lzma","time", "tokio"] +tokio = ["tokio/io-util"] unreserved = [] default = [ "aes-crypto", @@ -82,6 +106,7 @@ default = [ "deflate-zlib-ng", "deflate-zopfli", "lzma", + "sync", "time", "zstd", ] diff --git a/fuzz/corpus/fuzz_read/019c8bfcf6e2a0f39504d02bc7c8bb34812e4887 b/fuzz/corpus/fuzz_read/019c8bfcf6e2a0f39504d02bc7c8bb34812e4887 new file mode 100644 index 000000000..8d7a7b09d Binary files /dev/null and b/fuzz/corpus/fuzz_read/019c8bfcf6e2a0f39504d02bc7c8bb34812e4887 differ diff --git a/fuzz/corpus/fuzz_read/370651fc79b3e4782de1002358f618238b875d08 b/fuzz/corpus/fuzz_read/06f31fb623538066764dd8e746764877796eea48 similarity index 89% rename from fuzz/corpus/fuzz_read/370651fc79b3e4782de1002358f618238b875d08 rename to fuzz/corpus/fuzz_read/06f31fb623538066764dd8e746764877796eea48 index df00162f5..a2f331b73 100644 Binary files a/fuzz/corpus/fuzz_read/370651fc79b3e4782de1002358f618238b875d08 and b/fuzz/corpus/fuzz_read/06f31fb623538066764dd8e746764877796eea48 differ diff --git a/fuzz/corpus/fuzz_read/0a58f7ee2ab822e077de7f018cdb03e16c28d960 b/fuzz/corpus/fuzz_read/0a58f7ee2ab822e077de7f018cdb03e16c28d960 new file mode 100644 index 000000000..81dff849c Binary files /dev/null and b/fuzz/corpus/fuzz_read/0a58f7ee2ab822e077de7f018cdb03e16c28d960 differ diff --git a/fuzz/corpus/fuzz_read/0e3e457faab9969ec629c52f9cd4982c5140a027 b/fuzz/corpus/fuzz_read/0e3e457faab9969ec629c52f9cd4982c5140a027 new file mode 100644 index 000000000..47f70418a Binary files /dev/null and b/fuzz/corpus/fuzz_read/0e3e457faab9969ec629c52f9cd4982c5140a027 differ diff --git a/fuzz/corpus/fuzz_read/110f5cbf787fbba053e81394af110604b2b4dcff b/fuzz/corpus/fuzz_read/110f5cbf787fbba053e81394af110604b2b4dcff deleted file mode 100644 index 3f3548a8c..000000000 Binary files a/fuzz/corpus/fuzz_read/110f5cbf787fbba053e81394af110604b2b4dcff and /dev/null differ diff --git a/fuzz/corpus/fuzz_read/1131a07f6681078e9ecfd3fbf8f23401951b57ea b/fuzz/corpus/fuzz_read/1131a07f6681078e9ecfd3fbf8f23401951b57ea new file mode 100644 index 000000000..61e984bcc Binary files /dev/null and b/fuzz/corpus/fuzz_read/1131a07f6681078e9ecfd3fbf8f23401951b57ea differ diff --git a/fuzz/corpus/fuzz_read/116a56cfaba358c33ba5752206654a0e78fe1dce b/fuzz/corpus/fuzz_read/116a56cfaba358c33ba5752206654a0e78fe1dce new file mode 100644 index 000000000..6dd086957 Binary files /dev/null and b/fuzz/corpus/fuzz_read/116a56cfaba358c33ba5752206654a0e78fe1dce differ diff --git a/fuzz/corpus/fuzz_read/159aaa6f8f7bcad7dccd2400a36cbe31c786c4e1 b/fuzz/corpus/fuzz_read/159aaa6f8f7bcad7dccd2400a36cbe31c786c4e1 new file mode 100644 index 000000000..72dd8a69f Binary files /dev/null and b/fuzz/corpus/fuzz_read/159aaa6f8f7bcad7dccd2400a36cbe31c786c4e1 differ diff --git a/fuzz/corpus/fuzz_read/34a0aa51dd90905f218fb626ddd5521d6e9641a6 b/fuzz/corpus/fuzz_read/34a0aa51dd90905f218fb626ddd5521d6e9641a6 new file mode 100644 index 000000000..79c17400e Binary files /dev/null and b/fuzz/corpus/fuzz_read/34a0aa51dd90905f218fb626ddd5521d6e9641a6 differ diff --git a/fuzz/corpus/fuzz_read/3f26e1e17a91ba019a42711f950ac148497ab19c b/fuzz/corpus/fuzz_read/3f26e1e17a91ba019a42711f950ac148497ab19c deleted file mode 100644 index 617245a94..000000000 Binary files a/fuzz/corpus/fuzz_read/3f26e1e17a91ba019a42711f950ac148497ab19c and /dev/null differ diff --git a/fuzz/corpus/fuzz_read/41f2b36a77af07c2ce1eaa9da39561200f1ae850 b/fuzz/corpus/fuzz_read/41f2b36a77af07c2ce1eaa9da39561200f1ae850 new file mode 100644 index 000000000..a08ea5894 Binary files /dev/null and b/fuzz/corpus/fuzz_read/41f2b36a77af07c2ce1eaa9da39561200f1ae850 differ diff --git a/fuzz/corpus/fuzz_read/42924eb4ba0ace9ef2b2bfd94c90a656f91bb3a8 b/fuzz/corpus/fuzz_read/42924eb4ba0ace9ef2b2bfd94c90a656f91bb3a8 new file mode 100644 index 000000000..91ca121cb Binary files /dev/null and b/fuzz/corpus/fuzz_read/42924eb4ba0ace9ef2b2bfd94c90a656f91bb3a8 differ diff --git a/fuzz/corpus/fuzz_read/430b7455adafc907f672910c4bcd1028232a1e53 b/fuzz/corpus/fuzz_read/430b7455adafc907f672910c4bcd1028232a1e53 new file mode 100644 index 000000000..dd3cbc254 Binary files /dev/null and b/fuzz/corpus/fuzz_read/430b7455adafc907f672910c4bcd1028232a1e53 differ diff --git a/fuzz/corpus/fuzz_read/47783f3a01ca82718d8a6c66221399cdeaf1c30f b/fuzz/corpus/fuzz_read/47783f3a01ca82718d8a6c66221399cdeaf1c30f deleted file mode 100644 index 3cc4f57a2..000000000 Binary files a/fuzz/corpus/fuzz_read/47783f3a01ca82718d8a6c66221399cdeaf1c30f and /dev/null differ diff --git a/fuzz/corpus/fuzz_read/cf9ffcefefec9fbb2c0e50629a1a36c882a4784a b/fuzz/corpus/fuzz_read/49ebb9bdd61e500c6eff877486d34607819d1f85 similarity index 79% rename from fuzz/corpus/fuzz_read/cf9ffcefefec9fbb2c0e50629a1a36c882a4784a rename to fuzz/corpus/fuzz_read/49ebb9bdd61e500c6eff877486d34607819d1f85 index 8c4989c40..7804c9aa1 100644 Binary files a/fuzz/corpus/fuzz_read/cf9ffcefefec9fbb2c0e50629a1a36c882a4784a and b/fuzz/corpus/fuzz_read/49ebb9bdd61e500c6eff877486d34607819d1f85 differ diff --git a/fuzz/corpus/fuzz_read/55be0351b7bef24421f2fa6768521dfd8e15719c b/fuzz/corpus/fuzz_read/55be0351b7bef24421f2fa6768521dfd8e15719c new file mode 100644 index 000000000..9e56c7712 Binary files /dev/null and b/fuzz/corpus/fuzz_read/55be0351b7bef24421f2fa6768521dfd8e15719c differ diff --git a/fuzz/corpus/fuzz_read/5ba9fa14f3f0f86f4b22ac255f0ae813e948f28c b/fuzz/corpus/fuzz_read/5ba9fa14f3f0f86f4b22ac255f0ae813e948f28c deleted file mode 100644 index 98ce78bd0..000000000 Binary files a/fuzz/corpus/fuzz_read/5ba9fa14f3f0f86f4b22ac255f0ae813e948f28c and /dev/null differ diff --git a/fuzz/corpus/fuzz_read/6a6c4f710b70b26c94a88efa28a4e33db6bad937 b/fuzz/corpus/fuzz_read/6a6c4f710b70b26c94a88efa28a4e33db6bad937 new file mode 100644 index 000000000..f3565f1a3 Binary files /dev/null and b/fuzz/corpus/fuzz_read/6a6c4f710b70b26c94a88efa28a4e33db6bad937 differ diff --git a/fuzz/corpus/fuzz_read/6b9e2302f5b83fad82a7695a7ed83882ec060476 b/fuzz/corpus/fuzz_read/6b9e2302f5b83fad82a7695a7ed83882ec060476 new file mode 100644 index 000000000..cc558fbfa Binary files /dev/null and b/fuzz/corpus/fuzz_read/6b9e2302f5b83fad82a7695a7ed83882ec060476 differ diff --git a/fuzz/corpus/fuzz_read/6e15b9f9c7b0dd5df30a211abf5cba8545c95cee b/fuzz/corpus/fuzz_read/6e15b9f9c7b0dd5df30a211abf5cba8545c95cee new file mode 100644 index 000000000..847547d77 Binary files /dev/null and b/fuzz/corpus/fuzz_read/6e15b9f9c7b0dd5df30a211abf5cba8545c95cee differ diff --git a/fuzz/corpus/fuzz_read/7f19933f263fa3944b254f8caea77f22294145e4 b/fuzz/corpus/fuzz_read/7f19933f263fa3944b254f8caea77f22294145e4 deleted file mode 100644 index d1fddacf0..000000000 Binary files a/fuzz/corpus/fuzz_read/7f19933f263fa3944b254f8caea77f22294145e4 and /dev/null differ diff --git a/fuzz/corpus/fuzz_read/8021bf5230ec2fd27f145b7e460216dd362329d4 b/fuzz/corpus/fuzz_read/8021bf5230ec2fd27f145b7e460216dd362329d4 new file mode 100644 index 000000000..c1e0ded0c Binary files /dev/null and b/fuzz/corpus/fuzz_read/8021bf5230ec2fd27f145b7e460216dd362329d4 differ diff --git a/fuzz/corpus/fuzz_read/8051fabc50844c730df40c46d0f0b6363a408034 b/fuzz/corpus/fuzz_read/8051fabc50844c730df40c46d0f0b6363a408034 deleted file mode 100644 index 7f25fb62e..000000000 Binary files a/fuzz/corpus/fuzz_read/8051fabc50844c730df40c46d0f0b6363a408034 and /dev/null differ diff --git a/fuzz/corpus/fuzz_read/8192c940f4dfc3fbda7467808afe2944b308d488 b/fuzz/corpus/fuzz_read/8192c940f4dfc3fbda7467808afe2944b308d488 new file mode 100644 index 000000000..3c8a1e7f7 Binary files /dev/null and b/fuzz/corpus/fuzz_read/8192c940f4dfc3fbda7467808afe2944b308d488 differ diff --git a/fuzz/corpus/fuzz_read/8afe4d1bad2d3cbf8c1b41508849eb44f4873cd6 b/fuzz/corpus/fuzz_read/8afe4d1bad2d3cbf8c1b41508849eb44f4873cd6 new file mode 100644 index 000000000..e2d14b664 Binary files /dev/null and b/fuzz/corpus/fuzz_read/8afe4d1bad2d3cbf8c1b41508849eb44f4873cd6 differ diff --git a/fuzz/corpus/fuzz_read/8b8354a90039c69337f79234c25484b1440153dd b/fuzz/corpus/fuzz_read/8b8354a90039c69337f79234c25484b1440153dd new file mode 100644 index 000000000..168b38043 Binary files /dev/null and b/fuzz/corpus/fuzz_read/8b8354a90039c69337f79234c25484b1440153dd differ diff --git a/fuzz/corpus/fuzz_read/98152f7f7623d746f780399c64fe55a0b803923a b/fuzz/corpus/fuzz_read/98152f7f7623d746f780399c64fe55a0b803923a new file mode 100644 index 000000000..b93a0d161 Binary files /dev/null and b/fuzz/corpus/fuzz_read/98152f7f7623d746f780399c64fe55a0b803923a differ diff --git a/fuzz/corpus/fuzz_read/9c478f8a10294eef29fac8ff86d9fdf539f3d824 b/fuzz/corpus/fuzz_read/9c478f8a10294eef29fac8ff86d9fdf539f3d824 new file mode 100644 index 000000000..5b107578d Binary files /dev/null and b/fuzz/corpus/fuzz_read/9c478f8a10294eef29fac8ff86d9fdf539f3d824 differ diff --git a/fuzz/corpus/fuzz_read/a6ee2d3f4e9966428ccb0c674acee81ad691c80e b/fuzz/corpus/fuzz_read/a6ee2d3f4e9966428ccb0c674acee81ad691c80e deleted file mode 100644 index 0a2d56588..000000000 Binary files a/fuzz/corpus/fuzz_read/a6ee2d3f4e9966428ccb0c674acee81ad691c80e and /dev/null differ diff --git a/fuzz/corpus/fuzz_read/a810ee160e91b465c236afdea2f79b5bcb829be0 b/fuzz/corpus/fuzz_read/a810ee160e91b465c236afdea2f79b5bcb829be0 new file mode 100644 index 000000000..9be5193a9 Binary files /dev/null and b/fuzz/corpus/fuzz_read/a810ee160e91b465c236afdea2f79b5bcb829be0 differ diff --git a/fuzz/corpus/fuzz_read/b400e1bcd82491191d6e4d677437fa1e4632d21f b/fuzz/corpus/fuzz_read/b400e1bcd82491191d6e4d677437fa1e4632d21f new file mode 100644 index 000000000..d02195e1f Binary files /dev/null and b/fuzz/corpus/fuzz_read/b400e1bcd82491191d6e4d677437fa1e4632d21f differ diff --git a/fuzz/corpus/fuzz_read/b7fd7ee9eb40b280e2fa8f78a39b4989aee9e073 b/fuzz/corpus/fuzz_read/b7fd7ee9eb40b280e2fa8f78a39b4989aee9e073 new file mode 100644 index 000000000..5b384aaf4 Binary files /dev/null and b/fuzz/corpus/fuzz_read/b7fd7ee9eb40b280e2fa8f78a39b4989aee9e073 differ diff --git a/fuzz/corpus/fuzz_read/ba02b67868bcf9583f797d42fe25744db526dc87 b/fuzz/corpus/fuzz_read/ba02b67868bcf9583f797d42fe25744db526dc87 deleted file mode 100644 index f7e15d4dc..000000000 Binary files a/fuzz/corpus/fuzz_read/ba02b67868bcf9583f797d42fe25744db526dc87 and /dev/null differ diff --git a/fuzz/corpus/fuzz_read/c0cafdba839eedc796e119ff82ad100d3e1abc4a b/fuzz/corpus/fuzz_read/c0cafdba839eedc796e119ff82ad100d3e1abc4a new file mode 100644 index 000000000..7e8e88b61 Binary files /dev/null and b/fuzz/corpus/fuzz_read/c0cafdba839eedc796e119ff82ad100d3e1abc4a differ diff --git a/fuzz/corpus/fuzz_read/c1409732af8289277a5a21075f6d4a26188ab8db b/fuzz/corpus/fuzz_read/c1409732af8289277a5a21075f6d4a26188ab8db deleted file mode 100644 index 9835cadca..000000000 Binary files a/fuzz/corpus/fuzz_read/c1409732af8289277a5a21075f6d4a26188ab8db and /dev/null differ diff --git a/fuzz/corpus/fuzz_read/c30fa0680cd367c0a6d999a8829a3e76be42fca2 b/fuzz/corpus/fuzz_read/c30fa0680cd367c0a6d999a8829a3e76be42fca2 new file mode 100644 index 000000000..529461369 Binary files /dev/null and b/fuzz/corpus/fuzz_read/c30fa0680cd367c0a6d999a8829a3e76be42fca2 differ diff --git a/fuzz/corpus/fuzz_read/cc1d23b6e796a3ab7346cbf19a3e9e5050e88a9b b/fuzz/corpus/fuzz_read/cc1d23b6e796a3ab7346cbf19a3e9e5050e88a9b new file mode 100644 index 000000000..37ed7abb6 Binary files /dev/null and b/fuzz/corpus/fuzz_read/cc1d23b6e796a3ab7346cbf19a3e9e5050e88a9b differ diff --git a/fuzz/corpus/fuzz_read/d3ce2736a9f125c8ba2340992a38a4f4d92a2564 b/fuzz/corpus/fuzz_read/d3ce2736a9f125c8ba2340992a38a4f4d92a2564 new file mode 100644 index 000000000..0de9a5026 Binary files /dev/null and b/fuzz/corpus/fuzz_read/d3ce2736a9f125c8ba2340992a38a4f4d92a2564 differ diff --git a/fuzz/corpus/fuzz_read/d438bd6a0c51f77c005c5b888ef2e07430a4b701 b/fuzz/corpus/fuzz_read/d438bd6a0c51f77c005c5b888ef2e07430a4b701 new file mode 100644 index 000000000..ab9a46097 Binary files /dev/null and b/fuzz/corpus/fuzz_read/d438bd6a0c51f77c005c5b888ef2e07430a4b701 differ diff --git a/fuzz/corpus/fuzz_read/da37ea434d5ed679551951af7f16c05f64828864 b/fuzz/corpus/fuzz_read/da37ea434d5ed679551951af7f16c05f64828864 new file mode 100644 index 000000000..74eb54b4c Binary files /dev/null and b/fuzz/corpus/fuzz_read/da37ea434d5ed679551951af7f16c05f64828864 differ diff --git a/fuzz/corpus/fuzz_read/dac4aa320536c9d1e783925f91171c389ddcde94 b/fuzz/corpus/fuzz_read/dac4aa320536c9d1e783925f91171c389ddcde94 deleted file mode 100644 index ffc4a38c1..000000000 Binary files a/fuzz/corpus/fuzz_read/dac4aa320536c9d1e783925f91171c389ddcde94 and /dev/null differ diff --git a/fuzz/corpus/fuzz_read/fb3c0f45a986ca65f2f56e9284f77866bc4e93eb b/fuzz/corpus/fuzz_read/fb3c0f45a986ca65f2f56e9284f77866bc4e93eb new file mode 100644 index 000000000..157fd45ed Binary files /dev/null and b/fuzz/corpus/fuzz_read/fb3c0f45a986ca65f2f56e9284f77866bc4e93eb differ diff --git a/fuzz/corpus/fuzz_write/040b549640f6aef57b0c3ff7f3f5ecab3b313cb5 b/fuzz/corpus/fuzz_write/040b549640f6aef57b0c3ff7f3f5ecab3b313cb5 new file mode 100644 index 000000000..d0f45b4e4 Binary files /dev/null and b/fuzz/corpus/fuzz_write/040b549640f6aef57b0c3ff7f3f5ecab3b313cb5 differ diff --git a/fuzz/corpus/fuzz_write/04c4997b51cae7239a72715281bd99feb349c647 b/fuzz/corpus/fuzz_write/04c4997b51cae7239a72715281bd99feb349c647 new file mode 100644 index 000000000..ee8cc1210 Binary files /dev/null and b/fuzz/corpus/fuzz_write/04c4997b51cae7239a72715281bd99feb349c647 differ diff --git a/fuzz/corpus/fuzz_write/065b3abb5108d0195dea24d37eeedf67dfb6a381 b/fuzz/corpus/fuzz_write/065b3abb5108d0195dea24d37eeedf67dfb6a381 new file mode 100644 index 000000000..007d95a8d Binary files /dev/null and b/fuzz/corpus/fuzz_write/065b3abb5108d0195dea24d37eeedf67dfb6a381 differ diff --git a/fuzz/corpus/fuzz_write/067d07028d75abc58527d9d0afb360e6291bde37 b/fuzz/corpus/fuzz_write/067d07028d75abc58527d9d0afb360e6291bde37 new file mode 100644 index 000000000..5a0d9e3f3 Binary files /dev/null and b/fuzz/corpus/fuzz_write/067d07028d75abc58527d9d0afb360e6291bde37 differ diff --git a/fuzz/corpus/fuzz_write/0789d72c17a5b84d298170d693367a0be7a2f0fc b/fuzz/corpus/fuzz_write/0789d72c17a5b84d298170d693367a0be7a2f0fc new file mode 100644 index 000000000..345ab469b Binary files /dev/null and b/fuzz/corpus/fuzz_write/0789d72c17a5b84d298170d693367a0be7a2f0fc differ diff --git a/fuzz/corpus/fuzz_write/08220b2a54482ffc228446b9ee448c8943f6783e b/fuzz/corpus/fuzz_write/08220b2a54482ffc228446b9ee448c8943f6783e deleted file mode 100644 index 0c7d7dafa..000000000 Binary files a/fuzz/corpus/fuzz_write/08220b2a54482ffc228446b9ee448c8943f6783e and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/0eabde1680227e799be7bb7df9b7c59037714be3 b/fuzz/corpus/fuzz_write/0eabde1680227e799be7bb7df9b7c59037714be3 deleted file mode 100644 index 7d0643bfe..000000000 Binary files a/fuzz/corpus/fuzz_write/0eabde1680227e799be7bb7df9b7c59037714be3 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/0f499182bc99844fef7c8437a1c32b9fd0915a02 b/fuzz/corpus/fuzz_write/0f499182bc99844fef7c8437a1c32b9fd0915a02 new file mode 100644 index 000000000..bb5fe4d91 Binary files /dev/null and b/fuzz/corpus/fuzz_write/0f499182bc99844fef7c8437a1c32b9fd0915a02 differ diff --git a/fuzz/corpus/fuzz_write/1830711dbd2791fef483f6edc47a291549b26fcd b/fuzz/corpus/fuzz_write/1830711dbd2791fef483f6edc47a291549b26fcd new file mode 100644 index 000000000..882265726 Binary files /dev/null and b/fuzz/corpus/fuzz_write/1830711dbd2791fef483f6edc47a291549b26fcd differ diff --git a/fuzz/corpus/fuzz_write/1954077934afbf7d6b9a061c1515b24c7109551e b/fuzz/corpus/fuzz_write/1954077934afbf7d6b9a061c1515b24c7109551e new file mode 100644 index 000000000..7cb790d85 Binary files /dev/null and b/fuzz/corpus/fuzz_write/1954077934afbf7d6b9a061c1515b24c7109551e differ diff --git a/fuzz/corpus/fuzz_write/1d389e4c93af1687abbb0d3f206b58db6104fc02 b/fuzz/corpus/fuzz_write/1d389e4c93af1687abbb0d3f206b58db6104fc02 new file mode 100644 index 000000000..f85cd283c Binary files /dev/null and b/fuzz/corpus/fuzz_write/1d389e4c93af1687abbb0d3f206b58db6104fc02 differ diff --git a/fuzz/corpus/fuzz_write/1d48838eb5245c2f87594c679bad8d18f030c07f b/fuzz/corpus/fuzz_write/1d48838eb5245c2f87594c679bad8d18f030c07f new file mode 100644 index 000000000..4a1de1937 Binary files /dev/null and b/fuzz/corpus/fuzz_write/1d48838eb5245c2f87594c679bad8d18f030c07f differ diff --git a/fuzz/corpus/fuzz_write/1dae961448e74c73567e686dfacec88c1df4cb90 b/fuzz/corpus/fuzz_write/1dae961448e74c73567e686dfacec88c1df4cb90 deleted file mode 100644 index 6438c2c7e..000000000 Binary files a/fuzz/corpus/fuzz_write/1dae961448e74c73567e686dfacec88c1df4cb90 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/1fba93f6fc7311d6b7eb7a9963380c8eda88475b b/fuzz/corpus/fuzz_write/1fba93f6fc7311d6b7eb7a9963380c8eda88475b new file mode 100644 index 000000000..3c429af32 Binary files /dev/null and b/fuzz/corpus/fuzz_write/1fba93f6fc7311d6b7eb7a9963380c8eda88475b differ diff --git a/fuzz/corpus/fuzz_write/200a4b89561b39dc48ff2e0a61cfc809332cb1d0 b/fuzz/corpus/fuzz_write/200a4b89561b39dc48ff2e0a61cfc809332cb1d0 new file mode 100644 index 000000000..456fd0484 Binary files /dev/null and b/fuzz/corpus/fuzz_write/200a4b89561b39dc48ff2e0a61cfc809332cb1d0 differ diff --git a/fuzz/corpus/fuzz_write/209fa8fe4b42baf5e34887aeb0edf94688cc63dd b/fuzz/corpus/fuzz_write/209fa8fe4b42baf5e34887aeb0edf94688cc63dd new file mode 100644 index 000000000..8c33a3d20 Binary files /dev/null and b/fuzz/corpus/fuzz_write/209fa8fe4b42baf5e34887aeb0edf94688cc63dd differ diff --git a/fuzz/corpus/fuzz_write/233bfc53a9120ead9996acb36e8942bff74e1492 b/fuzz/corpus/fuzz_write/233bfc53a9120ead9996acb36e8942bff74e1492 new file mode 100644 index 000000000..760921c2c Binary files /dev/null and b/fuzz/corpus/fuzz_write/233bfc53a9120ead9996acb36e8942bff74e1492 differ diff --git a/fuzz/corpus/fuzz_write/258030bcd10032e492e6e4d8b0bce78a19fd464b b/fuzz/corpus/fuzz_write/258030bcd10032e492e6e4d8b0bce78a19fd464b new file mode 100644 index 000000000..18395664c Binary files /dev/null and b/fuzz/corpus/fuzz_write/258030bcd10032e492e6e4d8b0bce78a19fd464b differ diff --git a/fuzz/corpus/fuzz_write/29018a952fcbfd963ae4af36033ff0409296ac6c b/fuzz/corpus/fuzz_write/29018a952fcbfd963ae4af36033ff0409296ac6c deleted file mode 100644 index 312b738a1..000000000 Binary files a/fuzz/corpus/fuzz_write/29018a952fcbfd963ae4af36033ff0409296ac6c and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/2a5a999e20c2504bef2ed192cd4ae1458a3ce1a8 b/fuzz/corpus/fuzz_write/2a5a999e20c2504bef2ed192cd4ae1458a3ce1a8 new file mode 100644 index 000000000..4fe38e755 Binary files /dev/null and b/fuzz/corpus/fuzz_write/2a5a999e20c2504bef2ed192cd4ae1458a3ce1a8 differ diff --git a/fuzz/corpus/fuzz_write/2deaf0291a879a99e066566f0d77e709ce02b480 b/fuzz/corpus/fuzz_write/2deaf0291a879a99e066566f0d77e709ce02b480 new file mode 100644 index 000000000..2bdfd529c Binary files /dev/null and b/fuzz/corpus/fuzz_write/2deaf0291a879a99e066566f0d77e709ce02b480 differ diff --git a/fuzz/corpus/fuzz_write/2e0e8bc4c8adc01e935495d85c74864382ce7e19 b/fuzz/corpus/fuzz_write/2e0e8bc4c8adc01e935495d85c74864382ce7e19 new file mode 100644 index 000000000..34197046d Binary files /dev/null and b/fuzz/corpus/fuzz_write/2e0e8bc4c8adc01e935495d85c74864382ce7e19 differ diff --git a/fuzz/corpus/fuzz_write/2e522bba59dc10b8c333861e03b4a4a679f41c9f b/fuzz/corpus/fuzz_write/2e522bba59dc10b8c333861e03b4a4a679f41c9f new file mode 100644 index 000000000..cc1ab39ae Binary files /dev/null and b/fuzz/corpus/fuzz_write/2e522bba59dc10b8c333861e03b4a4a679f41c9f differ diff --git a/fuzz/corpus/fuzz_write/336e95e761bf4eb53e37ace38ac2ba4a699fd5e9 b/fuzz/corpus/fuzz_write/336e95e761bf4eb53e37ace38ac2ba4a699fd5e9 new file mode 100644 index 000000000..4e39a9492 Binary files /dev/null and b/fuzz/corpus/fuzz_write/336e95e761bf4eb53e37ace38ac2ba4a699fd5e9 differ diff --git a/fuzz/corpus/fuzz_write/33ca792e4b3380c5e63fa77ca72001899c0dde44 b/fuzz/corpus/fuzz_write/33ca792e4b3380c5e63fa77ca72001899c0dde44 new file mode 100644 index 000000000..f7173fe63 Binary files /dev/null and b/fuzz/corpus/fuzz_write/33ca792e4b3380c5e63fa77ca72001899c0dde44 differ diff --git a/fuzz/corpus/fuzz_write/3494830f936515d2dfa5fd22da65fbfeaed02a82 b/fuzz/corpus/fuzz_write/3494830f936515d2dfa5fd22da65fbfeaed02a82 new file mode 100644 index 000000000..153d0cdfa Binary files /dev/null and b/fuzz/corpus/fuzz_write/3494830f936515d2dfa5fd22da65fbfeaed02a82 differ diff --git a/fuzz/corpus/fuzz_write/3572a9845b65d2a06ef4e8497c0f7a334226b5f2 b/fuzz/corpus/fuzz_write/3572a9845b65d2a06ef4e8497c0f7a334226b5f2 new file mode 100644 index 000000000..ebea64f1b Binary files /dev/null and b/fuzz/corpus/fuzz_write/3572a9845b65d2a06ef4e8497c0f7a334226b5f2 differ diff --git a/fuzz/corpus/fuzz_write/3583774a805e9874c77d712a3383c9826b47c960 b/fuzz/corpus/fuzz_write/3583774a805e9874c77d712a3383c9826b47c960 deleted file mode 100644 index 9c290fd51..000000000 Binary files a/fuzz/corpus/fuzz_write/3583774a805e9874c77d712a3383c9826b47c960 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/382817cbec4bd6d7b7a3bb59d289f718c89f0392 b/fuzz/corpus/fuzz_write/382817cbec4bd6d7b7a3bb59d289f718c89f0392 new file mode 100644 index 000000000..dca28fe79 Binary files /dev/null and b/fuzz/corpus/fuzz_write/382817cbec4bd6d7b7a3bb59d289f718c89f0392 differ diff --git a/fuzz/corpus/fuzz_write/396789d05dc588d88d7317766a263c5ed76b34d7 b/fuzz/corpus/fuzz_write/396789d05dc588d88d7317766a263c5ed76b34d7 new file mode 100644 index 000000000..16efc361e Binary files /dev/null and b/fuzz/corpus/fuzz_write/396789d05dc588d88d7317766a263c5ed76b34d7 differ diff --git a/fuzz/corpus/fuzz_write/39f7a2608f4927b9db04dee0bdbe0b539d1d758d b/fuzz/corpus/fuzz_write/39f7a2608f4927b9db04dee0bdbe0b539d1d758d new file mode 100644 index 000000000..aac7d4c15 Binary files /dev/null and b/fuzz/corpus/fuzz_write/39f7a2608f4927b9db04dee0bdbe0b539d1d758d differ diff --git a/fuzz/corpus/fuzz_write/3cf84b84d303b12325b4cac0bbfc709064562a62 b/fuzz/corpus/fuzz_write/3cf84b84d303b12325b4cac0bbfc709064562a62 new file mode 100644 index 000000000..47d1db229 Binary files /dev/null and b/fuzz/corpus/fuzz_write/3cf84b84d303b12325b4cac0bbfc709064562a62 differ diff --git a/fuzz/corpus/fuzz_write/8c02cfa0069ae9a4ecad41ca3e159c09ff00328c b/fuzz/corpus/fuzz_write/3d73c62d2a2d6b00c475864ddf2393dfaa27f10b similarity index 85% rename from fuzz/corpus/fuzz_write/8c02cfa0069ae9a4ecad41ca3e159c09ff00328c rename to fuzz/corpus/fuzz_write/3d73c62d2a2d6b00c475864ddf2393dfaa27f10b index 612dd5259..f882d3ea1 100644 Binary files a/fuzz/corpus/fuzz_write/8c02cfa0069ae9a4ecad41ca3e159c09ff00328c and b/fuzz/corpus/fuzz_write/3d73c62d2a2d6b00c475864ddf2393dfaa27f10b differ diff --git a/fuzz/corpus/fuzz_write/3e6c5e8891fb286b53372b586143b99fbe109a9e b/fuzz/corpus/fuzz_write/3e6c5e8891fb286b53372b586143b99fbe109a9e new file mode 100644 index 000000000..9aff9e78d Binary files /dev/null and b/fuzz/corpus/fuzz_write/3e6c5e8891fb286b53372b586143b99fbe109a9e differ diff --git a/fuzz/corpus/fuzz_write/40304037be01aa178c1d117b74b9ef8acd18fcd9 b/fuzz/corpus/fuzz_write/40304037be01aa178c1d117b74b9ef8acd18fcd9 new file mode 100644 index 000000000..f06e8a658 Binary files /dev/null and b/fuzz/corpus/fuzz_write/40304037be01aa178c1d117b74b9ef8acd18fcd9 differ diff --git a/fuzz/corpus/fuzz_write/4350b0a6acb951a53ea443960795b79fa2e78642 b/fuzz/corpus/fuzz_write/4350b0a6acb951a53ea443960795b79fa2e78642 new file mode 100644 index 000000000..2a1139ebe Binary files /dev/null and b/fuzz/corpus/fuzz_write/4350b0a6acb951a53ea443960795b79fa2e78642 differ diff --git a/fuzz/corpus/fuzz_write/457f626c9723d1654d4eb4d1ad74da5cca22ca41 b/fuzz/corpus/fuzz_write/457f626c9723d1654d4eb4d1ad74da5cca22ca41 new file mode 100644 index 000000000..807b65f57 Binary files /dev/null and b/fuzz/corpus/fuzz_write/457f626c9723d1654d4eb4d1ad74da5cca22ca41 differ diff --git a/fuzz/corpus/fuzz_write/475029a9a19107fccd990135f242fb5d6f61a5e8 b/fuzz/corpus/fuzz_write/475029a9a19107fccd990135f242fb5d6f61a5e8 new file mode 100644 index 000000000..fe12bc568 Binary files /dev/null and b/fuzz/corpus/fuzz_write/475029a9a19107fccd990135f242fb5d6f61a5e8 differ diff --git a/fuzz/corpus/fuzz_write/4773386289158d62fc0d85b54244812e91881c8e b/fuzz/corpus/fuzz_write/4773386289158d62fc0d85b54244812e91881c8e deleted file mode 100644 index c640eb688..000000000 Binary files a/fuzz/corpus/fuzz_write/4773386289158d62fc0d85b54244812e91881c8e and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/480dcfec5d4e3cefea3e939f6759e06a1b019928 b/fuzz/corpus/fuzz_write/480dcfec5d4e3cefea3e939f6759e06a1b019928 new file mode 100644 index 000000000..219ed5f34 Binary files /dev/null and b/fuzz/corpus/fuzz_write/480dcfec5d4e3cefea3e939f6759e06a1b019928 differ diff --git a/fuzz/corpus/fuzz_write/488c33d51947a56294be41a4bdf94d17002c454c b/fuzz/corpus/fuzz_write/488c33d51947a56294be41a4bdf94d17002c454c new file mode 100644 index 000000000..18bd56edd Binary files /dev/null and b/fuzz/corpus/fuzz_write/488c33d51947a56294be41a4bdf94d17002c454c differ diff --git a/fuzz/corpus/fuzz_write/4921220f9a2ce55611e2824cd3c39aa511dfb8e5 b/fuzz/corpus/fuzz_write/4921220f9a2ce55611e2824cd3c39aa511dfb8e5 new file mode 100644 index 000000000..6ff60add4 Binary files /dev/null and b/fuzz/corpus/fuzz_write/4921220f9a2ce55611e2824cd3c39aa511dfb8e5 differ diff --git a/fuzz/corpus/fuzz_write/49a5fac1ae49328b289712912fea13156435ffb2 b/fuzz/corpus/fuzz_write/49a5fac1ae49328b289712912fea13156435ffb2 deleted file mode 100644 index 8b9014d5b..000000000 Binary files a/fuzz/corpus/fuzz_write/49a5fac1ae49328b289712912fea13156435ffb2 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/4ab9580bd35308f744503b46b94ee286eb61f6f2 b/fuzz/corpus/fuzz_write/4ab9580bd35308f744503b46b94ee286eb61f6f2 new file mode 100644 index 000000000..433672001 Binary files /dev/null and b/fuzz/corpus/fuzz_write/4ab9580bd35308f744503b46b94ee286eb61f6f2 differ diff --git a/fuzz/corpus/fuzz_write/4b68f36fe04ecea312a4f0f9c02f13996c0ff010 b/fuzz/corpus/fuzz_write/4b68f36fe04ecea312a4f0f9c02f13996c0ff010 new file mode 100644 index 000000000..1d6c8ee19 Binary files /dev/null and b/fuzz/corpus/fuzz_write/4b68f36fe04ecea312a4f0f9c02f13996c0ff010 differ diff --git a/fuzz/corpus/fuzz_write/4d0b6106b569cfed448f1ab7605aed415ac9efee b/fuzz/corpus/fuzz_write/4d0b6106b569cfed448f1ab7605aed415ac9efee new file mode 100644 index 000000000..f0cd63751 Binary files /dev/null and b/fuzz/corpus/fuzz_write/4d0b6106b569cfed448f1ab7605aed415ac9efee differ diff --git a/fuzz/corpus/fuzz_write/4eee2a214afba54fadbe9a082d1989dcfa7d5aa4 b/fuzz/corpus/fuzz_write/4eee2a214afba54fadbe9a082d1989dcfa7d5aa4 new file mode 100644 index 000000000..71b3922c2 Binary files /dev/null and b/fuzz/corpus/fuzz_write/4eee2a214afba54fadbe9a082d1989dcfa7d5aa4 differ diff --git a/fuzz/corpus/fuzz_write/507390266b77f0dde2fbd6e9844132933554a73c b/fuzz/corpus/fuzz_write/507390266b77f0dde2fbd6e9844132933554a73c new file mode 100644 index 000000000..6af889c97 Binary files /dev/null and b/fuzz/corpus/fuzz_write/507390266b77f0dde2fbd6e9844132933554a73c differ diff --git a/fuzz/corpus/fuzz_write/508d587b573d080de181e71891a6698c17e1e311 b/fuzz/corpus/fuzz_write/508d587b573d080de181e71891a6698c17e1e311 new file mode 100644 index 000000000..defad3282 Binary files /dev/null and b/fuzz/corpus/fuzz_write/508d587b573d080de181e71891a6698c17e1e311 differ diff --git a/fuzz/corpus/fuzz_write/512334645b1554d07770e79f1ef8c898e81d1e7b b/fuzz/corpus/fuzz_write/512334645b1554d07770e79f1ef8c898e81d1e7b deleted file mode 100644 index 740fc211f..000000000 Binary files a/fuzz/corpus/fuzz_write/512334645b1554d07770e79f1ef8c898e81d1e7b and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/519d6ce2de488d89ff4792448f5920f58f0d6c60 b/fuzz/corpus/fuzz_write/519d6ce2de488d89ff4792448f5920f58f0d6c60 new file mode 100644 index 000000000..7f6010da1 Binary files /dev/null and b/fuzz/corpus/fuzz_write/519d6ce2de488d89ff4792448f5920f58f0d6c60 differ diff --git a/fuzz/corpus/fuzz_write/566bc9dc31b53c07da8d87097b035946f0feea76 b/fuzz/corpus/fuzz_write/566bc9dc31b53c07da8d87097b035946f0feea76 new file mode 100644 index 000000000..99733195c Binary files /dev/null and b/fuzz/corpus/fuzz_write/566bc9dc31b53c07da8d87097b035946f0feea76 differ diff --git a/fuzz/corpus/fuzz_write/5704d0aa9ab65f2ee1bdb962f1ef5163352c125f b/fuzz/corpus/fuzz_write/5704d0aa9ab65f2ee1bdb962f1ef5163352c125f new file mode 100644 index 000000000..b41395714 Binary files /dev/null and b/fuzz/corpus/fuzz_write/5704d0aa9ab65f2ee1bdb962f1ef5163352c125f differ diff --git a/fuzz/corpus/fuzz_write/57ac44c923f4ef9c3e80063d9646d99e44b9038c b/fuzz/corpus/fuzz_write/57ac44c923f4ef9c3e80063d9646d99e44b9038c deleted file mode 100644 index 16e551817..000000000 Binary files a/fuzz/corpus/fuzz_write/57ac44c923f4ef9c3e80063d9646d99e44b9038c and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/5bdf13800c37ed54085bef8134d1d7c50351a5b8 b/fuzz/corpus/fuzz_write/5bdf13800c37ed54085bef8134d1d7c50351a5b8 deleted file mode 100644 index dfc8ca32b..000000000 Binary files a/fuzz/corpus/fuzz_write/5bdf13800c37ed54085bef8134d1d7c50351a5b8 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/61427d5b5cabf0278b7ff6d978968524ad518a0a b/fuzz/corpus/fuzz_write/61427d5b5cabf0278b7ff6d978968524ad518a0a new file mode 100644 index 000000000..4ba5bc4ac Binary files /dev/null and b/fuzz/corpus/fuzz_write/61427d5b5cabf0278b7ff6d978968524ad518a0a differ diff --git a/fuzz/corpus/fuzz_write/625bf9ab1cb07c9f5a67134e8c56cf7ff1e9e305 b/fuzz/corpus/fuzz_write/625bf9ab1cb07c9f5a67134e8c56cf7ff1e9e305 new file mode 100644 index 000000000..500b8a61f Binary files /dev/null and b/fuzz/corpus/fuzz_write/625bf9ab1cb07c9f5a67134e8c56cf7ff1e9e305 differ diff --git a/fuzz/corpus/fuzz_write/64924d68b5a4aec348d9ed51b3cd6319c60a7c13 b/fuzz/corpus/fuzz_write/64924d68b5a4aec348d9ed51b3cd6319c60a7c13 new file mode 100644 index 000000000..0eda5c333 Binary files /dev/null and b/fuzz/corpus/fuzz_write/64924d68b5a4aec348d9ed51b3cd6319c60a7c13 differ diff --git a/fuzz/corpus/fuzz_write/64f2f96cee1fd79e154c0bf63f64028d1b3df034 b/fuzz/corpus/fuzz_write/64f2f96cee1fd79e154c0bf63f64028d1b3df034 deleted file mode 100644 index 4d08940bf..000000000 Binary files a/fuzz/corpus/fuzz_write/64f2f96cee1fd79e154c0bf63f64028d1b3df034 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/65717e0373facba79a96d34aa40c00ca21ca5602 b/fuzz/corpus/fuzz_write/65717e0373facba79a96d34aa40c00ca21ca5602 deleted file mode 100644 index 96a8b0819..000000000 Binary files a/fuzz/corpus/fuzz_write/65717e0373facba79a96d34aa40c00ca21ca5602 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/664b03092b93cd24eaa371db0baf086865e53568 b/fuzz/corpus/fuzz_write/664b03092b93cd24eaa371db0baf086865e53568 new file mode 100644 index 000000000..d37fb0c2e Binary files /dev/null and b/fuzz/corpus/fuzz_write/664b03092b93cd24eaa371db0baf086865e53568 differ diff --git a/fuzz/corpus/fuzz_write/67d75719928b600d7cb621fa2dd34fd03a74ebae b/fuzz/corpus/fuzz_write/67d75719928b600d7cb621fa2dd34fd03a74ebae new file mode 100644 index 000000000..7e445adda Binary files /dev/null and b/fuzz/corpus/fuzz_write/67d75719928b600d7cb621fa2dd34fd03a74ebae differ diff --git a/fuzz/corpus/fuzz_write/687de92fd3dc455ed84a9cc07b8edde555b4bf54 b/fuzz/corpus/fuzz_write/687de92fd3dc455ed84a9cc07b8edde555b4bf54 new file mode 100644 index 000000000..93ef819cc Binary files /dev/null and b/fuzz/corpus/fuzz_write/687de92fd3dc455ed84a9cc07b8edde555b4bf54 differ diff --git a/fuzz/corpus/fuzz_write/689959e4b3e4abbc13eb79fcdc786e58ad3bfa9e b/fuzz/corpus/fuzz_write/689959e4b3e4abbc13eb79fcdc786e58ad3bfa9e new file mode 100644 index 000000000..415f9cf1c Binary files /dev/null and b/fuzz/corpus/fuzz_write/689959e4b3e4abbc13eb79fcdc786e58ad3bfa9e differ diff --git a/fuzz/corpus/fuzz_write/696ed4fc3c919221ccc3211c9b522a7bcce976f1 b/fuzz/corpus/fuzz_write/696ed4fc3c919221ccc3211c9b522a7bcce976f1 deleted file mode 100644 index 01bb59676..000000000 Binary files a/fuzz/corpus/fuzz_write/696ed4fc3c919221ccc3211c9b522a7bcce976f1 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/6af85b878b99229a6de4e1a2efe66ded214f5f6c b/fuzz/corpus/fuzz_write/6af85b878b99229a6de4e1a2efe66ded214f5f6c new file mode 100644 index 000000000..d5e710589 Binary files /dev/null and b/fuzz/corpus/fuzz_write/6af85b878b99229a6de4e1a2efe66ded214f5f6c differ diff --git a/fuzz/corpus/fuzz_write/6b17b0a4af43b0f9f3d1a7185b558d93e168751c b/fuzz/corpus/fuzz_write/6b17b0a4af43b0f9f3d1a7185b558d93e168751c new file mode 100644 index 000000000..f3d4761ca Binary files /dev/null and b/fuzz/corpus/fuzz_write/6b17b0a4af43b0f9f3d1a7185b558d93e168751c differ diff --git a/fuzz/corpus/fuzz_write/6c08c1bf7b525451bf5ca7cbd01f5f4d0c94c6e1 b/fuzz/corpus/fuzz_write/6c08c1bf7b525451bf5ca7cbd01f5f4d0c94c6e1 deleted file mode 100644 index 480207579..000000000 Binary files a/fuzz/corpus/fuzz_write/6c08c1bf7b525451bf5ca7cbd01f5f4d0c94c6e1 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/6d68e0560db48c549775bb2f698aa8b69a0f29ca b/fuzz/corpus/fuzz_write/6d68e0560db48c549775bb2f698aa8b69a0f29ca new file mode 100644 index 000000000..751f03a16 Binary files /dev/null and b/fuzz/corpus/fuzz_write/6d68e0560db48c549775bb2f698aa8b69a0f29ca differ diff --git a/fuzz/corpus/fuzz_write/6d8b5ca436ed188f6f9afbc2205ed2d12ab7d2bd b/fuzz/corpus/fuzz_write/6d8b5ca436ed188f6f9afbc2205ed2d12ab7d2bd new file mode 100644 index 000000000..d2b0bd40f Binary files /dev/null and b/fuzz/corpus/fuzz_write/6d8b5ca436ed188f6f9afbc2205ed2d12ab7d2bd differ diff --git a/fuzz/corpus/fuzz_write/6da4e6f8a01957eab1a1e2c9d94e4f5b3bf90277 b/fuzz/corpus/fuzz_write/6da4e6f8a01957eab1a1e2c9d94e4f5b3bf90277 new file mode 100644 index 000000000..05b5169e9 Binary files /dev/null and b/fuzz/corpus/fuzz_write/6da4e6f8a01957eab1a1e2c9d94e4f5b3bf90277 differ diff --git a/fuzz/corpus/fuzz_write/72489e3c88ecf6ea12a547034129df1dc71f4697 b/fuzz/corpus/fuzz_write/72489e3c88ecf6ea12a547034129df1dc71f4697 deleted file mode 100644 index 864d28804..000000000 Binary files a/fuzz/corpus/fuzz_write/72489e3c88ecf6ea12a547034129df1dc71f4697 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/72c49dbc3ceefe03a073f95fdd90075efef449ec b/fuzz/corpus/fuzz_write/72c49dbc3ceefe03a073f95fdd90075efef449ec deleted file mode 100644 index 4883fb31a..000000000 Binary files a/fuzz/corpus/fuzz_write/72c49dbc3ceefe03a073f95fdd90075efef449ec and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/72ecd095908cbd7a6cdfa5bacd8d3a234aeb7e63 b/fuzz/corpus/fuzz_write/72ecd095908cbd7a6cdfa5bacd8d3a234aeb7e63 deleted file mode 100644 index 752f2aef2..000000000 Binary files a/fuzz/corpus/fuzz_write/72ecd095908cbd7a6cdfa5bacd8d3a234aeb7e63 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/75ec38ff4ae8129531a0438043414e63a13c3af7 b/fuzz/corpus/fuzz_write/75ec38ff4ae8129531a0438043414e63a13c3af7 new file mode 100644 index 000000000..919f34eb6 Binary files /dev/null and b/fuzz/corpus/fuzz_write/75ec38ff4ae8129531a0438043414e63a13c3af7 differ diff --git a/fuzz/corpus/fuzz_write/774faccd7bcf5a5802265c6be4275e74500fb4ac b/fuzz/corpus/fuzz_write/774faccd7bcf5a5802265c6be4275e74500fb4ac new file mode 100644 index 000000000..278371734 Binary files /dev/null and b/fuzz/corpus/fuzz_write/774faccd7bcf5a5802265c6be4275e74500fb4ac differ diff --git a/fuzz/corpus/fuzz_write/78814c51503fb35809cc9191f4a5974bab541cbf b/fuzz/corpus/fuzz_write/78814c51503fb35809cc9191f4a5974bab541cbf new file mode 100644 index 000000000..beec918b0 Binary files /dev/null and b/fuzz/corpus/fuzz_write/78814c51503fb35809cc9191f4a5974bab541cbf differ diff --git a/fuzz/corpus/fuzz_write/79b1a1b8e88f91771d4709f6e4865892b450de57 b/fuzz/corpus/fuzz_write/79b1a1b8e88f91771d4709f6e4865892b450de57 deleted file mode 100644 index 059479dcb..000000000 Binary files a/fuzz/corpus/fuzz_write/79b1a1b8e88f91771d4709f6e4865892b450de57 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/7a8dc6a199b3d007a0fb72942895f0de926f82fe b/fuzz/corpus/fuzz_write/7a8dc6a199b3d007a0fb72942895f0de926f82fe new file mode 100644 index 000000000..194b11b84 Binary files /dev/null and b/fuzz/corpus/fuzz_write/7a8dc6a199b3d007a0fb72942895f0de926f82fe differ diff --git a/fuzz/corpus/fuzz_write/7bd45db8423c9a4596bc6e01a7e408685b1648dc b/fuzz/corpus/fuzz_write/7bd45db8423c9a4596bc6e01a7e408685b1648dc deleted file mode 100644 index 1ce6be647..000000000 Binary files a/fuzz/corpus/fuzz_write/7bd45db8423c9a4596bc6e01a7e408685b1648dc and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/7d4ddcfa4373f45d478efc874701703ddb39e9b0 b/fuzz/corpus/fuzz_write/7d4ddcfa4373f45d478efc874701703ddb39e9b0 new file mode 100644 index 000000000..6276776de Binary files /dev/null and b/fuzz/corpus/fuzz_write/7d4ddcfa4373f45d478efc874701703ddb39e9b0 differ diff --git a/fuzz/corpus/fuzz_write/7dcff5bcb3d43356e94c4749911277b2917697fa b/fuzz/corpus/fuzz_write/7dcff5bcb3d43356e94c4749911277b2917697fa deleted file mode 100644 index 7dd1f8a2b..000000000 Binary files a/fuzz/corpus/fuzz_write/7dcff5bcb3d43356e94c4749911277b2917697fa and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/7e380a13d82a8ecc2677f426a96e51534d151604 b/fuzz/corpus/fuzz_write/7e380a13d82a8ecc2677f426a96e51534d151604 deleted file mode 100644 index 408bf407e..000000000 Binary files a/fuzz/corpus/fuzz_write/7e380a13d82a8ecc2677f426a96e51534d151604 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/801f748efb447c4b9309bdf948f9f1e144ab7699 b/fuzz/corpus/fuzz_write/801f748efb447c4b9309bdf948f9f1e144ab7699 deleted file mode 100644 index 323b9e6e3..000000000 Binary files a/fuzz/corpus/fuzz_write/801f748efb447c4b9309bdf948f9f1e144ab7699 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/81ccbd9be9ec79eec24dfa5338054c540c074cac b/fuzz/corpus/fuzz_write/81ccbd9be9ec79eec24dfa5338054c540c074cac deleted file mode 100644 index ea44fccf5..000000000 Binary files a/fuzz/corpus/fuzz_write/81ccbd9be9ec79eec24dfa5338054c540c074cac and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/84b8d3d91b987e994fc85511d4a1920289e7984c b/fuzz/corpus/fuzz_write/84b8d3d91b987e994fc85511d4a1920289e7984c new file mode 100644 index 000000000..1bb8c8698 Binary files /dev/null and b/fuzz/corpus/fuzz_write/84b8d3d91b987e994fc85511d4a1920289e7984c differ diff --git a/fuzz/corpus/fuzz_write/852aa22fd53f7075a7104b632a550b3681ff169a b/fuzz/corpus/fuzz_write/852aa22fd53f7075a7104b632a550b3681ff169a new file mode 100644 index 000000000..112897b08 Binary files /dev/null and b/fuzz/corpus/fuzz_write/852aa22fd53f7075a7104b632a550b3681ff169a differ diff --git a/fuzz/corpus/fuzz_write/8593052cc5f8976bf7cb53c4a0c24a7d1ada8a82 b/fuzz/corpus/fuzz_write/8593052cc5f8976bf7cb53c4a0c24a7d1ada8a82 deleted file mode 100644 index a985ba9ee..000000000 Binary files a/fuzz/corpus/fuzz_write/8593052cc5f8976bf7cb53c4a0c24a7d1ada8a82 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/864dd3cc7af635312484dfa337ecde1b8dbdf140 b/fuzz/corpus/fuzz_write/864dd3cc7af635312484dfa337ecde1b8dbdf140 new file mode 100644 index 000000000..166278581 Binary files /dev/null and b/fuzz/corpus/fuzz_write/864dd3cc7af635312484dfa337ecde1b8dbdf140 differ diff --git a/fuzz/corpus/fuzz_write/8788c779c1947e0c78dbac2f0ad99e29681f94f7 b/fuzz/corpus/fuzz_write/8788c779c1947e0c78dbac2f0ad99e29681f94f7 new file mode 100644 index 000000000..a0fe972ba Binary files /dev/null and b/fuzz/corpus/fuzz_write/8788c779c1947e0c78dbac2f0ad99e29681f94f7 differ diff --git a/fuzz/corpus/fuzz_write/89a2a78b04bc79d938bfc392c45dea3a46e154bc b/fuzz/corpus/fuzz_write/89a2a78b04bc79d938bfc392c45dea3a46e154bc new file mode 100644 index 000000000..213fcbbbe Binary files /dev/null and b/fuzz/corpus/fuzz_write/89a2a78b04bc79d938bfc392c45dea3a46e154bc differ diff --git a/fuzz/corpus/fuzz_write/8aba822423e4ecb85ec9504fb44054ff118c93b9 b/fuzz/corpus/fuzz_write/8aba822423e4ecb85ec9504fb44054ff118c93b9 deleted file mode 100644 index 75ab06b3a..000000000 Binary files a/fuzz/corpus/fuzz_write/8aba822423e4ecb85ec9504fb44054ff118c93b9 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/8d95303e29184c21dba2ee4e69884af3fe719b5e b/fuzz/corpus/fuzz_write/8d95303e29184c21dba2ee4e69884af3fe719b5e new file mode 100644 index 000000000..35d5f8ce3 Binary files /dev/null and b/fuzz/corpus/fuzz_write/8d95303e29184c21dba2ee4e69884af3fe719b5e differ diff --git a/fuzz/corpus/fuzz_write/8de15ff4d95b571161d18ad963620c65fbcb7757 b/fuzz/corpus/fuzz_write/8de15ff4d95b571161d18ad963620c65fbcb7757 new file mode 100644 index 000000000..ea27ef47b Binary files /dev/null and b/fuzz/corpus/fuzz_write/8de15ff4d95b571161d18ad963620c65fbcb7757 differ diff --git a/fuzz/corpus/fuzz_write/8ded3b724e4e17a8af5377de0754827c0d8a0a3e b/fuzz/corpus/fuzz_write/8ded3b724e4e17a8af5377de0754827c0d8a0a3e new file mode 100644 index 000000000..71aacb9a8 Binary files /dev/null and b/fuzz/corpus/fuzz_write/8ded3b724e4e17a8af5377de0754827c0d8a0a3e differ diff --git a/fuzz/corpus/fuzz_write/90f4914db71c3352c878a7fb1c44a03113f55435 b/fuzz/corpus/fuzz_write/90f4914db71c3352c878a7fb1c44a03113f55435 deleted file mode 100644 index 2c05a248a..000000000 Binary files a/fuzz/corpus/fuzz_write/90f4914db71c3352c878a7fb1c44a03113f55435 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/920260d144dc94ad444398b567e964d73ca44f9e b/fuzz/corpus/fuzz_write/920260d144dc94ad444398b567e964d73ca44f9e new file mode 100644 index 000000000..cec2f6ce7 Binary files /dev/null and b/fuzz/corpus/fuzz_write/920260d144dc94ad444398b567e964d73ca44f9e differ diff --git a/fuzz/corpus/fuzz_write/944a346ae52a03c1a7337fc7c87a2f8e4742850b b/fuzz/corpus/fuzz_write/944a346ae52a03c1a7337fc7c87a2f8e4742850b new file mode 100644 index 000000000..450197f26 Binary files /dev/null and b/fuzz/corpus/fuzz_write/944a346ae52a03c1a7337fc7c87a2f8e4742850b differ diff --git a/fuzz/corpus/fuzz_write/95cf7289af99052df43f3b65737cb75884c5e10a b/fuzz/corpus/fuzz_write/95cf7289af99052df43f3b65737cb75884c5e10a new file mode 100644 index 000000000..9c8d7adc1 Binary files /dev/null and b/fuzz/corpus/fuzz_write/95cf7289af99052df43f3b65737cb75884c5e10a differ diff --git a/fuzz/corpus/fuzz_write/9aeb063c60a9860fc30780f871e6fd340dd7403a b/fuzz/corpus/fuzz_write/9aeb063c60a9860fc30780f871e6fd340dd7403a new file mode 100644 index 000000000..fb4e77384 Binary files /dev/null and b/fuzz/corpus/fuzz_write/9aeb063c60a9860fc30780f871e6fd340dd7403a differ diff --git a/fuzz/corpus/fuzz_write/9c59e64c8b489629da8aa131095c26696bdd3b71 b/fuzz/corpus/fuzz_write/9c59e64c8b489629da8aa131095c26696bdd3b71 new file mode 100644 index 000000000..9b07633aa Binary files /dev/null and b/fuzz/corpus/fuzz_write/9c59e64c8b489629da8aa131095c26696bdd3b71 differ diff --git a/fuzz/corpus/fuzz_write/9c8ac134fdad1e73bf0646a81267389b7f963bde b/fuzz/corpus/fuzz_write/9c8ac134fdad1e73bf0646a81267389b7f963bde new file mode 100644 index 000000000..ac7521657 Binary files /dev/null and b/fuzz/corpus/fuzz_write/9c8ac134fdad1e73bf0646a81267389b7f963bde differ diff --git a/fuzz/corpus/fuzz_write/9ca0c8e90ecee4ce923643c7a233ea9991d68a62 b/fuzz/corpus/fuzz_write/9ca0c8e90ecee4ce923643c7a233ea9991d68a62 new file mode 100644 index 000000000..fc49e5107 Binary files /dev/null and b/fuzz/corpus/fuzz_write/9ca0c8e90ecee4ce923643c7a233ea9991d68a62 differ diff --git a/fuzz/corpus/fuzz_write/9debde139dae690926fe0d8f5bcf013b51632cbe b/fuzz/corpus/fuzz_write/9debde139dae690926fe0d8f5bcf013b51632cbe new file mode 100644 index 000000000..27c8017db Binary files /dev/null and b/fuzz/corpus/fuzz_write/9debde139dae690926fe0d8f5bcf013b51632cbe differ diff --git a/fuzz/corpus/fuzz_write/a023124e84e2c31591ee38699829921ce8e09efa b/fuzz/corpus/fuzz_write/a023124e84e2c31591ee38699829921ce8e09efa new file mode 100644 index 000000000..c1d6ca938 Binary files /dev/null and b/fuzz/corpus/fuzz_write/a023124e84e2c31591ee38699829921ce8e09efa differ diff --git a/fuzz/corpus/fuzz_write/a052dd5a3c1ada13f3f719607d134514e07963cd b/fuzz/corpus/fuzz_write/a052dd5a3c1ada13f3f719607d134514e07963cd new file mode 100644 index 000000000..5a1993b71 Binary files /dev/null and b/fuzz/corpus/fuzz_write/a052dd5a3c1ada13f3f719607d134514e07963cd differ diff --git a/fuzz/corpus/fuzz_write/a2f6302a9961c10e49ae3aaffd7335944c0217de b/fuzz/corpus/fuzz_write/a2f6302a9961c10e49ae3aaffd7335944c0217de deleted file mode 100644 index fd96cc1f4..000000000 Binary files a/fuzz/corpus/fuzz_write/a2f6302a9961c10e49ae3aaffd7335944c0217de and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/a316dd19918f60e9ae843585291f340a19f511fe b/fuzz/corpus/fuzz_write/a316dd19918f60e9ae843585291f340a19f511fe new file mode 100644 index 000000000..2d04bb90a Binary files /dev/null and b/fuzz/corpus/fuzz_write/a316dd19918f60e9ae843585291f340a19f511fe differ diff --git a/fuzz/corpus/fuzz_write/a833a7d49c837dc03e3c18de09079c9a2a08b36f b/fuzz/corpus/fuzz_write/a833a7d49c837dc03e3c18de09079c9a2a08b36f deleted file mode 100644 index 65e3e9f33..000000000 Binary files a/fuzz/corpus/fuzz_write/a833a7d49c837dc03e3c18de09079c9a2a08b36f and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/a8dbb85833b64d3aaf42667e3a8c66c544b095da b/fuzz/corpus/fuzz_write/a8dbb85833b64d3aaf42667e3a8c66c544b095da new file mode 100644 index 000000000..a24ab3d09 Binary files /dev/null and b/fuzz/corpus/fuzz_write/a8dbb85833b64d3aaf42667e3a8c66c544b095da differ diff --git a/fuzz/corpus/fuzz_write/aa0f203c1e6d73f6d2c1931428f3a50d3d3159e0 b/fuzz/corpus/fuzz_write/aa0f203c1e6d73f6d2c1931428f3a50d3d3159e0 new file mode 100644 index 000000000..d3cad4c6d Binary files /dev/null and b/fuzz/corpus/fuzz_write/aa0f203c1e6d73f6d2c1931428f3a50d3d3159e0 differ diff --git a/fuzz/corpus/fuzz_write/ab6594c50a0e471097af9bf9e9d643a8de283c5f b/fuzz/corpus/fuzz_write/ab6594c50a0e471097af9bf9e9d643a8de283c5f new file mode 100644 index 000000000..f0c9c0af7 Binary files /dev/null and b/fuzz/corpus/fuzz_write/ab6594c50a0e471097af9bf9e9d643a8de283c5f differ diff --git a/fuzz/corpus/fuzz_write/abc9e1c96fb12ac4dbae5fa4e08aeb96165a2d02 b/fuzz/corpus/fuzz_write/abc9e1c96fb12ac4dbae5fa4e08aeb96165a2d02 new file mode 100644 index 000000000..0d1947ee1 Binary files /dev/null and b/fuzz/corpus/fuzz_write/abc9e1c96fb12ac4dbae5fa4e08aeb96165a2d02 differ diff --git a/fuzz/corpus/fuzz_write/abf9761554b820aef4e462e637b638b69f2274c0 b/fuzz/corpus/fuzz_write/abf9761554b820aef4e462e637b638b69f2274c0 new file mode 100644 index 000000000..fa9dd3d25 Binary files /dev/null and b/fuzz/corpus/fuzz_write/abf9761554b820aef4e462e637b638b69f2274c0 differ diff --git a/fuzz/corpus/fuzz_write/ad0eb1bb73c7ff273db0b419b0327da14bea51fb b/fuzz/corpus/fuzz_write/ad0eb1bb73c7ff273db0b419b0327da14bea51fb deleted file mode 100644 index eb2064a51..000000000 Binary files a/fuzz/corpus/fuzz_write/ad0eb1bb73c7ff273db0b419b0327da14bea51fb and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/ad1e139f66b779fd5611bdb59a4ad156fbef1376 b/fuzz/corpus/fuzz_write/ad1e139f66b779fd5611bdb59a4ad156fbef1376 deleted file mode 100644 index 0acb2b882..000000000 Binary files a/fuzz/corpus/fuzz_write/ad1e139f66b779fd5611bdb59a4ad156fbef1376 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/adf3b89038d3b77ddaf522658fbdae1f05d7e9fb b/fuzz/corpus/fuzz_write/adf3b89038d3b77ddaf522658fbdae1f05d7e9fb deleted file mode 100644 index f6ea3833d..000000000 Binary files a/fuzz/corpus/fuzz_write/adf3b89038d3b77ddaf522658fbdae1f05d7e9fb and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/af85b5d04bd588f74b042bcf1839f375899b8114 b/fuzz/corpus/fuzz_write/af85b5d04bd588f74b042bcf1839f375899b8114 new file mode 100644 index 000000000..62e74a611 Binary files /dev/null and b/fuzz/corpus/fuzz_write/af85b5d04bd588f74b042bcf1839f375899b8114 differ diff --git a/fuzz/corpus/fuzz_write/b177214021fdefd17b383027374ac65000d24e48 b/fuzz/corpus/fuzz_write/b177214021fdefd17b383027374ac65000d24e48 new file mode 100644 index 000000000..712ad39be Binary files /dev/null and b/fuzz/corpus/fuzz_write/b177214021fdefd17b383027374ac65000d24e48 differ diff --git a/fuzz/corpus/fuzz_write/b1bcbe30df5281ae9cccc6cce5167b60383c879f b/fuzz/corpus/fuzz_write/b1bcbe30df5281ae9cccc6cce5167b60383c879f new file mode 100644 index 000000000..11b430bdb Binary files /dev/null and b/fuzz/corpus/fuzz_write/b1bcbe30df5281ae9cccc6cce5167b60383c879f differ diff --git a/fuzz/corpus/fuzz_write/b1d9618a19742259c2ed6c965b7ab2279e3806ca b/fuzz/corpus/fuzz_write/b1d9618a19742259c2ed6c965b7ab2279e3806ca deleted file mode 100644 index cf474b34b..000000000 Binary files a/fuzz/corpus/fuzz_write/b1d9618a19742259c2ed6c965b7ab2279e3806ca and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/b1f781c0001bbd9778cd6e400ff573374ce533ea b/fuzz/corpus/fuzz_write/b1f781c0001bbd9778cd6e400ff573374ce533ea deleted file mode 100644 index 8a77cb811..000000000 Binary files a/fuzz/corpus/fuzz_write/b1f781c0001bbd9778cd6e400ff573374ce533ea and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/3683ea1cf2ae880d806a5a85fd7ddf9ed571fcab b/fuzz/corpus/fuzz_write/b234aaff4d312a8999de3187bdff55634ba50c8c similarity index 72% rename from fuzz/corpus/fuzz_write/3683ea1cf2ae880d806a5a85fd7ddf9ed571fcab rename to fuzz/corpus/fuzz_write/b234aaff4d312a8999de3187bdff55634ba50c8c index a17c8ddb1..a6e5000bb 100644 Binary files a/fuzz/corpus/fuzz_write/3683ea1cf2ae880d806a5a85fd7ddf9ed571fcab and b/fuzz/corpus/fuzz_write/b234aaff4d312a8999de3187bdff55634ba50c8c differ diff --git a/fuzz/corpus/fuzz_write/b2699886f15b1ca72455b54ff9b37a237da8a252 b/fuzz/corpus/fuzz_write/b2699886f15b1ca72455b54ff9b37a237da8a252 new file mode 100644 index 000000000..2aaaa60c6 Binary files /dev/null and b/fuzz/corpus/fuzz_write/b2699886f15b1ca72455b54ff9b37a237da8a252 differ diff --git a/fuzz/corpus/fuzz_write/bc9f059f0b393f6f23d6cd6328040227672fbe7e b/fuzz/corpus/fuzz_write/bc9f059f0b393f6f23d6cd6328040227672fbe7e deleted file mode 100644 index beabe698a..000000000 Binary files a/fuzz/corpus/fuzz_write/bc9f059f0b393f6f23d6cd6328040227672fbe7e and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/bd3684f924c0b9542976f6777df2a15635af33b4 b/fuzz/corpus/fuzz_write/bd3684f924c0b9542976f6777df2a15635af33b4 new file mode 100644 index 000000000..7470ee6cc Binary files /dev/null and b/fuzz/corpus/fuzz_write/bd3684f924c0b9542976f6777df2a15635af33b4 differ diff --git a/fuzz/corpus/fuzz_write/bece4e44d6614eb0c55f0cf0f54297acf0c65d57 b/fuzz/corpus/fuzz_write/bece4e44d6614eb0c55f0cf0f54297acf0c65d57 deleted file mode 100644 index 664a05752..000000000 Binary files a/fuzz/corpus/fuzz_write/bece4e44d6614eb0c55f0cf0f54297acf0c65d57 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/bf41768e88fd266b1da7f161c89fa0f20aee50e9 b/fuzz/corpus/fuzz_write/bf41768e88fd266b1da7f161c89fa0f20aee50e9 new file mode 100644 index 000000000..9563e3ce7 Binary files /dev/null and b/fuzz/corpus/fuzz_write/bf41768e88fd266b1da7f161c89fa0f20aee50e9 differ diff --git a/fuzz/corpus/fuzz_write/bff13adbdbe7c9f1ea19b46189f248dc316fed24 b/fuzz/corpus/fuzz_write/bff13adbdbe7c9f1ea19b46189f248dc316fed24 new file mode 100644 index 000000000..fdc2e3ed9 Binary files /dev/null and b/fuzz/corpus/fuzz_write/bff13adbdbe7c9f1ea19b46189f248dc316fed24 differ diff --git a/fuzz/corpus/fuzz_write/c3768fca74ca772409996955fdbfd46cff0f1a8d b/fuzz/corpus/fuzz_write/c3768fca74ca772409996955fdbfd46cff0f1a8d new file mode 100644 index 000000000..6df015643 Binary files /dev/null and b/fuzz/corpus/fuzz_write/c3768fca74ca772409996955fdbfd46cff0f1a8d differ diff --git a/fuzz/corpus/fuzz_write/c5c4cde83788cbf0faf4c51a97d5630d020c5c8c b/fuzz/corpus/fuzz_write/c5c4cde83788cbf0faf4c51a97d5630d020c5c8c new file mode 100644 index 000000000..92be2d9fe Binary files /dev/null and b/fuzz/corpus/fuzz_write/c5c4cde83788cbf0faf4c51a97d5630d020c5c8c differ diff --git a/fuzz/corpus/fuzz_write/c913368cf938e068235361e53b27a6000091fb92 b/fuzz/corpus/fuzz_write/c913368cf938e068235361e53b27a6000091fb92 new file mode 100644 index 000000000..47c3d4c9d Binary files /dev/null and b/fuzz/corpus/fuzz_write/c913368cf938e068235361e53b27a6000091fb92 differ diff --git a/fuzz/corpus/fuzz_write/c9d5d7dca894e05c162a051102ff94ea13c50a68 b/fuzz/corpus/fuzz_write/c9d5d7dca894e05c162a051102ff94ea13c50a68 new file mode 100644 index 000000000..8cfdca888 Binary files /dev/null and b/fuzz/corpus/fuzz_write/c9d5d7dca894e05c162a051102ff94ea13c50a68 differ diff --git a/fuzz/corpus/fuzz_write/c9f8004bea284b80bcb6cdd0606143c9a1b94249 b/fuzz/corpus/fuzz_write/c9f8004bea284b80bcb6cdd0606143c9a1b94249 new file mode 100644 index 000000000..b2fb1d5d2 Binary files /dev/null and b/fuzz/corpus/fuzz_write/c9f8004bea284b80bcb6cdd0606143c9a1b94249 differ diff --git a/fuzz/corpus/fuzz_write/cae18387976cbfc33bab8044aec293bb1c9b3af8 b/fuzz/corpus/fuzz_write/cae18387976cbfc33bab8044aec293bb1c9b3af8 new file mode 100644 index 000000000..3cfd7a626 Binary files /dev/null and b/fuzz/corpus/fuzz_write/cae18387976cbfc33bab8044aec293bb1c9b3af8 differ diff --git a/fuzz/corpus/fuzz_write/cb4835d663b53e2de71e763582a3357db5153f5b b/fuzz/corpus/fuzz_write/cb4835d663b53e2de71e763582a3357db5153f5b new file mode 100644 index 000000000..cf330e591 Binary files /dev/null and b/fuzz/corpus/fuzz_write/cb4835d663b53e2de71e763582a3357db5153f5b differ diff --git a/fuzz/corpus/fuzz_write/cbdd4dfb0f101f3e64c3663118dac8cbafc93a9a b/fuzz/corpus/fuzz_write/cbdd4dfb0f101f3e64c3663118dac8cbafc93a9a new file mode 100644 index 000000000..f93d6341a Binary files /dev/null and b/fuzz/corpus/fuzz_write/cbdd4dfb0f101f3e64c3663118dac8cbafc93a9a differ diff --git a/fuzz/corpus/fuzz_write/d2a173fbde746a342fd1a07736139db9d0146ceb b/fuzz/corpus/fuzz_write/d2a173fbde746a342fd1a07736139db9d0146ceb deleted file mode 100644 index 494adc516..000000000 Binary files a/fuzz/corpus/fuzz_write/d2a173fbde746a342fd1a07736139db9d0146ceb and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/d3604f81acaf02502ee56b8103821957ec174ce3 b/fuzz/corpus/fuzz_write/d3604f81acaf02502ee56b8103821957ec174ce3 deleted file mode 100644 index e9b971bc7..000000000 Binary files a/fuzz/corpus/fuzz_write/d3604f81acaf02502ee56b8103821957ec174ce3 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/d5447d8592e341356c89798dd92f8dfbd626fa01 b/fuzz/corpus/fuzz_write/d5447d8592e341356c89798dd92f8dfbd626fa01 deleted file mode 100644 index 6088578b5..000000000 Binary files a/fuzz/corpus/fuzz_write/d5447d8592e341356c89798dd92f8dfbd626fa01 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/d731e1be1d3defd0890f3c2a73e3d1d07eebd09e b/fuzz/corpus/fuzz_write/d731e1be1d3defd0890f3c2a73e3d1d07eebd09e new file mode 100644 index 000000000..963f88bc2 Binary files /dev/null and b/fuzz/corpus/fuzz_write/d731e1be1d3defd0890f3c2a73e3d1d07eebd09e differ diff --git a/fuzz/corpus/fuzz_write/d7653af0f02828fc6cbb0076e6e6d30db04b77a6 b/fuzz/corpus/fuzz_write/d7653af0f02828fc6cbb0076e6e6d30db04b77a6 new file mode 100644 index 000000000..80875cf57 Binary files /dev/null and b/fuzz/corpus/fuzz_write/d7653af0f02828fc6cbb0076e6e6d30db04b77a6 differ diff --git a/fuzz/corpus/fuzz_write/d82f622f75f6eaa7b6ed72d085b1a4d9f6d61352 b/fuzz/corpus/fuzz_write/d82f622f75f6eaa7b6ed72d085b1a4d9f6d61352 new file mode 100644 index 000000000..56c655d17 Binary files /dev/null and b/fuzz/corpus/fuzz_write/d82f622f75f6eaa7b6ed72d085b1a4d9f6d61352 differ diff --git a/fuzz/corpus/fuzz_write/d8cde1a5581abb06cfa6ea8fb6d2f7dd2dd898a7 b/fuzz/corpus/fuzz_write/d8cde1a5581abb06cfa6ea8fb6d2f7dd2dd898a7 new file mode 100644 index 000000000..c991ee152 Binary files /dev/null and b/fuzz/corpus/fuzz_write/d8cde1a5581abb06cfa6ea8fb6d2f7dd2dd898a7 differ diff --git a/fuzz/corpus/fuzz_write/d94cdff1089a532beb5e59d88e6807c900428145 b/fuzz/corpus/fuzz_write/d94cdff1089a532beb5e59d88e6807c900428145 deleted file mode 100644 index fc7753c5c..000000000 Binary files a/fuzz/corpus/fuzz_write/d94cdff1089a532beb5e59d88e6807c900428145 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/d9e285568d2107f497d162ed577d5d4965d4416b b/fuzz/corpus/fuzz_write/d9e285568d2107f497d162ed577d5d4965d4416b new file mode 100644 index 000000000..6b3428360 Binary files /dev/null and b/fuzz/corpus/fuzz_write/d9e285568d2107f497d162ed577d5d4965d4416b differ diff --git a/fuzz/corpus/fuzz_write/db315b3070a2af366e603d699085ac4846164b19 b/fuzz/corpus/fuzz_write/db315b3070a2af366e603d699085ac4846164b19 deleted file mode 100644 index d3fc382d0..000000000 Binary files a/fuzz/corpus/fuzz_write/db315b3070a2af366e603d699085ac4846164b19 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/de4e1a1e9f38bb876a32a2c53a00334a11148767 b/fuzz/corpus/fuzz_write/de4e1a1e9f38bb876a32a2c53a00334a11148767 new file mode 100644 index 000000000..71dca5c57 Binary files /dev/null and b/fuzz/corpus/fuzz_write/de4e1a1e9f38bb876a32a2c53a00334a11148767 differ diff --git a/fuzz/corpus/fuzz_write/dec24e99a6f38848838a513c0fec97ea592720a3 b/fuzz/corpus/fuzz_write/dec24e99a6f38848838a513c0fec97ea592720a3 new file mode 100644 index 000000000..d4858c4a3 Binary files /dev/null and b/fuzz/corpus/fuzz_write/dec24e99a6f38848838a513c0fec97ea592720a3 differ diff --git a/fuzz/corpus/fuzz_write/dedd117472b5d4ec3eecde02de58b200cdf1f10f b/fuzz/corpus/fuzz_write/dedd117472b5d4ec3eecde02de58b200cdf1f10f new file mode 100644 index 000000000..3236bea48 Binary files /dev/null and b/fuzz/corpus/fuzz_write/dedd117472b5d4ec3eecde02de58b200cdf1f10f differ diff --git a/fuzz/corpus/fuzz_write/e1e4cbe538b48c6f143e71bd990dfa730426d778 b/fuzz/corpus/fuzz_write/e1e4cbe538b48c6f143e71bd990dfa730426d778 new file mode 100644 index 000000000..fa229d8ed Binary files /dev/null and b/fuzz/corpus/fuzz_write/e1e4cbe538b48c6f143e71bd990dfa730426d778 differ diff --git a/fuzz/corpus/fuzz_write/e429f9c46f499f3c5905ffec51d4a132b2b6a25a b/fuzz/corpus/fuzz_write/e429f9c46f499f3c5905ffec51d4a132b2b6a25a new file mode 100644 index 000000000..166eda0ce Binary files /dev/null and b/fuzz/corpus/fuzz_write/e429f9c46f499f3c5905ffec51d4a132b2b6a25a differ diff --git a/fuzz/corpus/fuzz_write/e441ebc04d6e74502b9fabeb2da0f3062b070248 b/fuzz/corpus/fuzz_write/e441ebc04d6e74502b9fabeb2da0f3062b070248 deleted file mode 100644 index fc779e91a..000000000 Binary files a/fuzz/corpus/fuzz_write/e441ebc04d6e74502b9fabeb2da0f3062b070248 and /dev/null differ diff --git a/fuzz/corpus/fuzz_write/f5395136fb16aa5bd4fa32383cf52f85f2b47276 b/fuzz/corpus/fuzz_write/eb4de99d8d69a81fa28d98c8ae90e1552735a9ac similarity index 81% rename from fuzz/corpus/fuzz_write/f5395136fb16aa5bd4fa32383cf52f85f2b47276 rename to fuzz/corpus/fuzz_write/eb4de99d8d69a81fa28d98c8ae90e1552735a9ac index 73bb2b463..a8d2648c3 100644 Binary files a/fuzz/corpus/fuzz_write/f5395136fb16aa5bd4fa32383cf52f85f2b47276 and b/fuzz/corpus/fuzz_write/eb4de99d8d69a81fa28d98c8ae90e1552735a9ac differ diff --git a/fuzz/corpus/fuzz_write/f0244605b8de13c7ad906efb6ba66003e781b064 b/fuzz/corpus/fuzz_write/f0244605b8de13c7ad906efb6ba66003e781b064 new file mode 100644 index 000000000..0ee2f4b5b Binary files /dev/null and b/fuzz/corpus/fuzz_write/f0244605b8de13c7ad906efb6ba66003e781b064 differ diff --git a/fuzz/corpus/fuzz_write/f1d8650747a9904b6f613e8bbc1b8abf4f0de273 b/fuzz/corpus/fuzz_write/f1d8650747a9904b6f613e8bbc1b8abf4f0de273 new file mode 100644 index 000000000..bae8da17d Binary files /dev/null and b/fuzz/corpus/fuzz_write/f1d8650747a9904b6f613e8bbc1b8abf4f0de273 differ diff --git a/fuzz/corpus/fuzz_write/f2c2351d9b5c7fc9b43e721975d1116be978d28a b/fuzz/corpus/fuzz_write/f2c2351d9b5c7fc9b43e721975d1116be978d28a new file mode 100644 index 000000000..35cdaa551 Binary files /dev/null and b/fuzz/corpus/fuzz_write/f2c2351d9b5c7fc9b43e721975d1116be978d28a differ diff --git a/fuzz/corpus/fuzz_write/f6570bdf27436889c39dd87c44b87d97e0fbe63f b/fuzz/corpus/fuzz_write/f371ba5b4bdd6f2ed41a3ba149df83cfc0ed03ea similarity index 85% rename from fuzz/corpus/fuzz_write/f6570bdf27436889c39dd87c44b87d97e0fbe63f rename to fuzz/corpus/fuzz_write/f371ba5b4bdd6f2ed41a3ba149df83cfc0ed03ea index 851546587..e7f6fd155 100644 Binary files a/fuzz/corpus/fuzz_write/f6570bdf27436889c39dd87c44b87d97e0fbe63f and b/fuzz/corpus/fuzz_write/f371ba5b4bdd6f2ed41a3ba149df83cfc0ed03ea differ diff --git a/fuzz/corpus/fuzz_write/f6f1ba104c1def2c2bbea7aca98e57860f8dfa15 b/fuzz/corpus/fuzz_write/f6f1ba104c1def2c2bbea7aca98e57860f8dfa15 new file mode 100644 index 000000000..19539973d Binary files /dev/null and b/fuzz/corpus/fuzz_write/f6f1ba104c1def2c2bbea7aca98e57860f8dfa15 differ diff --git a/fuzz/corpus/fuzz_write/f78deb113d772b7884b167fd2a4ee6076116db92 b/fuzz/corpus/fuzz_write/f78deb113d772b7884b167fd2a4ee6076116db92 new file mode 100644 index 000000000..769145d26 Binary files /dev/null and b/fuzz/corpus/fuzz_write/f78deb113d772b7884b167fd2a4ee6076116db92 differ diff --git a/fuzz/corpus/fuzz_write/fb06e9ed4a8e9580db46f444e44e63e6018eefc4 b/fuzz/corpus/fuzz_write/fb06e9ed4a8e9580db46f444e44e63e6018eefc4 new file mode 100644 index 000000000..b3b4a635d Binary files /dev/null and b/fuzz/corpus/fuzz_write/fb06e9ed4a8e9580db46f444e44e63e6018eefc4 differ diff --git a/fuzz/corpus/fuzz_write/fb4e17df269f29003cc66731a7d9d71c704ba599 b/fuzz/corpus/fuzz_write/fb4e17df269f29003cc66731a7d9d71c704ba599 new file mode 100644 index 000000000..483a29554 Binary files /dev/null and b/fuzz/corpus/fuzz_write/fb4e17df269f29003cc66731a7d9d71c704ba599 differ diff --git a/fuzz/corpus/fuzz_write/fcda8512ce8f678cdbb10d685bd4c0c529dd2f06 b/fuzz/corpus/fuzz_write/fcda8512ce8f678cdbb10d685bd4c0c529dd2f06 new file mode 100644 index 000000000..badd60266 Binary files /dev/null and b/fuzz/corpus/fuzz_write/fcda8512ce8f678cdbb10d685bd4c0c529dd2f06 differ diff --git a/src/build.rs b/src/build.rs index 26d9689e7..0d777101d 100644 --- a/src/build.rs +++ b/src/build.rs @@ -4,4 +4,9 @@ fn main() { if var("CARGO_FEATURE_DEFLATE_MINIZ").is_ok() && var("CARGO_FEATURE__ALL_FEATURES").is_err() { println!("cargo:warning=Feature `deflate-miniz` is deprecated; replace it with `deflate`"); } + #[cfg(not(any(feature = "sync", feature = "tokio")))] + compile_error!("Missing Required feature"); + + #[cfg(all(feature = "sync", feature = "tokio"))] + compile_error!("The features sync and tokio cannot be used together") } diff --git a/src/lib.rs b/src/lib.rs index 35ffcaa68..f6fbb89f7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,6 +25,7 @@ //! | ZipCrypto deprecated encryption | ✅ | ✅ | //! //! +#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![warn(missing_docs)] #![allow(unexpected_cfgs)] // Needed for cfg(fuzzing) on nightly as of 2024-05-06 pub use crate::compression::{CompressionMethod, SUPPORTED_COMPRESSION_METHODS}; diff --git a/src/read.rs b/src/read.rs index 34823c5c3..25b155213 100644 --- a/src/read.rs +++ b/src/read.rs @@ -1,8 +1,13 @@ //! Types for reading ZIP archives /// Module for code with synchronous logic +#[cfg(feature = "sync")] pub mod sync; +/// Module for code with asynchronous logic +#[cfg(feature = "tokio")] +pub mod tokio; + #[cfg(feature = "aes-crypto")] use crate::{aes::AesReaderValid, types::AesVendorVersion}; use crate::{crc32::Crc32Reader, types::ZipFileData, zipcrypto::ZipCryptoReaderValid}; @@ -121,7 +126,6 @@ pub(crate) struct CentralDirectoryInfo { mod test { use crate::ZipArchive; use std::io::Cursor; - use tempdir::TempDir; #[test] fn invalid_offset() { @@ -316,16 +320,4 @@ mod test { let mut file = reader.by_index(0).unwrap(); assert_eq!(file.read(&mut decompressed).unwrap(), 12); } - - #[test] - fn test_is_symlink() -> std::io::Result<()> { - let mut v = Vec::new(); - v.extend_from_slice(include_bytes!("../tests/data/symlink.zip")); - let mut reader = ZipArchive::new(Cursor::new(v)).unwrap(); - assert!(reader.by_index(0).unwrap().is_symlink()); - let tempdir = TempDir::new("test_is_symlink")?; - reader.extract(&tempdir).unwrap(); - assert!(tempdir.path().join("bar").is_symlink()); - Ok(()) - } } diff --git a/src/read/stream.rs b/src/read/stream.rs index 081b3c6f3..8c08d6754 100644 --- a/src/read/stream.rs +++ b/src/read/stream.rs @@ -9,6 +9,7 @@ use std::fs; use std::io::{self, Read}; use std::path::{Path, PathBuf}; +#[cfg(feature = "sync")] use super::sync::{central_header_to_zip_file_inner, read_zipfile_from_stream}; /// Stream decoder for zip. diff --git a/src/read/tokio.rs b/src/read/tokio.rs new file mode 100644 index 000000000..f22a2de76 --- /dev/null +++ b/src/read/tokio.rs @@ -0,0 +1,328 @@ +use indexmap::IndexMap; +use std::{ + io::Cursor, + sync::{Arc, OnceLock}, +}; +use tokio::io::{AsyncRead, AsyncReadExt, AsyncSeek, AsyncSeekExt, AsyncWrite, SeekFrom}; + +use crate::{ + extra_fields::ExtendedTimestamp, + result::{ZipError, ZipResult}, + spec, + cp437::FromCp437, + types::{AesVendorVersion, System, ZipFileData}, + AesMode, CompressionMethod, DateTime, ExtraField, ZipArchive, +}; + +use super::CentralDirectoryInfo; + +impl ZipArchive +where + R: AsyncRead + AsyncSeek + Unpin, +{ + pub(crate) async fn merge_contents( + &mut self, + mut w: W, + ) -> ZipResult, ZipFileData>> + where + W: AsyncWrite + AsyncSeek + Unpin, + { + if self.shared.files.is_empty() { + return Ok(IndexMap::new()); + } + let mut new_files = self.shared.files.clone(); + + let new_initial_header_start = w.stream_position().await?; + new_files.values_mut().try_for_each(|f| { + f.header_start = f.header_start.checked_add(new_initial_header_start).ok_or( + ZipError::InvalidArchive("new header start from merge would have been to large"), + )?; + f.central_header_start = 0; + + if let Some(old_data_start) = f.data_start.take() { + let new_data_start = old_data_start.checked_add(new_initial_header_start).ok_or( + ZipError::InvalidArchive("new data start from merge would have been to large"), + )?; + f.data_start.get_or_init(|| new_data_start); + } + Ok::<_, ZipError>(()) + })?; + + self.reader.rewind().await?; + + let length_to_read = self.shared.dir_start; + + let mut limited_raw = (&mut self.reader as &mut R).take(length_to_read); + tokio::io::copy(&mut limited_raw, &mut w).await?; + + Ok(new_files) + } + + async fn get_directory_info_zip32( + footer: &spec::CentralDirectoryEnd, + cde_start_pos: u64, + ) -> ZipResult { + let archive_offset = cde_start_pos + .checked_sub(footer.central_directory_size as u64) + .and_then(|x| x.checked_sub(footer.central_directory_offset as u64)) + .ok_or(ZipError::InvalidArchive( + "Invalid central directory size or offset", + ))?; + let directory_start = footer.central_directory_offset as u64 + archive_offset; + let number_of_files = footer.number_of_files_on_this_disk as usize; + + Ok(CentralDirectoryInfo { + archive_offset, + directory_start, + number_of_files, + disk_number: footer.disk_number as u32, + disk_with_central_directory: footer.disk_with_central_directory as u32, + }) + } + + pub async fn get_directory_info_zip64( + reader: &mut R, + footer: &spec::CentralDirectoryEnd, + cde_start_pos: u64, + ) -> ZipResult>> { + reader + .seek(tokio::io::SeekFrom::End( + -(20 + 22 + footer.zip_file_comment.len() as i64), + )) + .await?; + + let locator64 = spec::Zip64CentralDirectoryEndLocator::parse(reader).await?; + + let search_upper_bound = cde_start_pos + .checked_sub(60) + .ok_or(ZipError::InvalidArchive( + "File cannot contain ZIP64 central directory end", + ))?; + + let search_results = spec::Zip64CentralDirectoryEnd::find_and_parse( + reader, + locator64.end_of_central_directory_offset, + search_upper_bound, + ) + .await?; + + let results: Vec> = search_results.iter().map(|(footer64, archive_offset)| { + let directory_start_result = footer64.central_directory_offset.checked_add(*archive_offset).ok_or(ZipError::InvalidArchive("Invalid central directory size or effect")); + directory_start_result.and_then(| directory_start| { + if directory_start > search_upper_bound { + Err(ZipError::InvalidArchive("Invalid central directory size or offset")) + } else if footer64.number_of_files_on_this_disk > footer64.number_of_files { + Err(ZipError::InvalidArchive("ZIP64 footer indicates more files on this disk then in the whole archive")) + } else if footer64.version_needed_to_extract > footer64.version_made_by { + Err(ZipError::InvalidArchive("ZIP64 footer indicates a new version is needed to extract this archive than the \ + version that wrote it")) + } else { + Ok(CentralDirectoryInfo { + archive_offset: *archive_offset, + directory_start, + number_of_files: footer64.number_of_files as usize, + disk_number: footer64.disk_number, + disk_with_central_directory: footer64.disk_with_central_directory + }) + } + }) + }).collect(); + Ok(results) + } +} + +pub(crate) async fn central_header_to_zip_file( + reader: &mut R, + archive_offset: u64, +) -> ZipResult +where + R: AsyncRead + AsyncSeek + Unpin, +{ + let central_header_start = reader.stream_position().await?; + + let signature = reader.read_u32_le().await?; + if signature != spec::CENTRAL_DIRECTORY_HEADER_SIGNATURE { + Err(ZipError::InvalidArchive("INvalid Central Directory header")) + } else { + central_header_to_zip_file_inner(reader, archive_offset, central_header_start).await + } +} + +async fn central_header_to_zip_file_inner( + reader: &mut R, + archive_offset: u64, + central_header_start: u64, +) -> ZipResult +where + R: AsyncRead + Unpin, +{ + let version_made_by = reader.read_u16_le().await?; + let _version_to_extract = reader.read_u16_le().await?; + let flags = reader.read_u16_le().await?; + let encrypted = flags & 1 == 1; + let is_utf8 = flags & (1 << 11) != 0; + let using_data_descriptor = flags & (1 << 3) != 0; + let compression_method = reader.read_u16_le().await?; + let last_mod_time = reader.read_u16_le().await?; + let last_mod_date = reader.read_u16_le().await?; + let crc32 = reader.read_u32_le().await?; + let compressed_size = reader.read_u32_le().await?; + let uncompressed_size = reader.read_u32_le().await?; + let file_name_length = reader.read_u16_le().await? as usize; + let extra_field_length = reader.read_u16_le().await? as usize; + let file_comment_length = reader.read_u16_le().await? as usize; + let _disk_number = reader.read_u16_le().await?; + let _internal_file_attributes = reader.read_u16_le().await?; + let external_file_attributes = reader.read_u32_le().await?; + let offset = reader.read_u32_le().await? as u64; + let mut file_name_raw = Vec::with_capacity(file_name_length); + let mut extra_field = Vec::with_capacity(extra_field_length); + let mut file_comment_raw = Vec::with_capacity(file_comment_length); + reader.read_exact(&mut file_name_raw).await?; + reader.read_exact(&mut extra_field).await?; + reader.read_exact(&mut file_comment_raw).await?; + + let file_name: Box = if is_utf8 { + String::from_utf8_lossy(&file_name_raw).into() + } else { + file_name_raw.from_cp437().into() + }; + let file_comment: Box = if is_utf8 { + String::from_utf8_lossy(&file_comment_raw).into() + } else { + file_comment_raw.from_cp437().into() + }; + + let mut result = ZipFileData { + system: System::from((version_made_by >> 8) as u8), + version_made_by: version_made_by as u8, + encrypted, + using_data_descriptor, + compression_method: { + #[allow(deprecated)] + CompressionMethod::from_u16(compression_method) + }, + compression_level: None, + last_modified_time: DateTime::from_msdos(last_mod_date, last_mod_time), + crc32, + compressed_size: compressed_size as u64, + uncompressed_size: uncompressed_size as u64, + file_name, + file_name_raw: file_name_raw.into(), + extra_field: Some(Arc::new(extra_field)), + central_extra_field: None, + file_comment, + header_start: offset, + extra_data_start: None, + central_header_start, + data_start: OnceLock::new(), + external_attributes: external_file_attributes, + large_file: false, + aes_mode: None, + aes_extra_data_start: 0, + extra_fields: Vec::new(), + }; + + match parse_extra_field(&mut result).await { + Ok(..) | Err(ZipError::Io(..)) => {} + Err(err) => return Err(err), + } + + let aes_enabled = result.compression_method == CompressionMethod::AES; + if aes_enabled && result.aes_mode.is_none() { + return Err(ZipError::InvalidArchive( + "AES encryption without AES extra data field", + )); + } + + result.header_start = result + .header_start + .checked_add(archive_offset) + .ok_or(ZipError::InvalidArchive("Archive header is too large"))?; + Ok(result) +} + +pub async fn parse_extra_field(file: &mut ZipFileData) -> ZipResult<()> { + let Some(extra_field) = &file.extra_field else { + return Ok(()); + }; + let mut reader = Cursor::new(extra_field.as_ref()); + + while (reader.position() as usize) < extra_field.len() { + let kind = reader.read_u16_le().await?; + let len = reader.read_u16_le().await?; + let mut len_left = len as i64; + match kind { + 0x001 => { + if file.uncompressed_size == spec::ZIP64_BYTES_THR { + file.large_file = true; + file.uncompressed_size = reader.read_u64_le().await?; + len_left -= 8; + } + if file.compressed_size == spec::ZIP64_BYTES_THR { + file.large_file = true; + file.compressed_size = reader.read_u64_le().await?; + len_left -= 8; + } + if file.header_start == spec::ZIP64_BYTES_THR { + file.header_start = reader.read_u64_le().await?; + len_left -= 8; + } + } + 0x9901 => { + if len != 7 { + return Err(ZipError::UnsupportedArchive( + "AES extra data field has an unsupported length", + )); + let vendor_version = reader.read_u16_le().await?; + let vendor_id = reader.read_u16_le().await?; + let mut out = [0u8]; + reader.read_exact(&mut out).await?; + let aes_mode = out[0]; + #[allow(deprecated)] + let compression_method = + CompressionMethod::from_u16(reader.read_u16_le().await?); + + if vendor_id != 0x4541 { + return Err(ZipError::InvalidArchive("Invalid AES vendor")); + } + let vendor_version = match vendor_version { + 0x0001 => AesVendorVersion::Ae1, + 0x0002 => AesVendorVersion::Ae2, + _ => return Err(ZipError::InvalidArchive("Invalid AES vendor version")), + }; + match aes_mode { + 0x01 => { + file.aes_mode = + Some((AesMode::Aes128, vendor_version, compression_method)) + } + 0x02 => { + file.aes_mode = + Some((AesMode::Aes192, vendor_version, compression_method)) + } + 0x03 => { + file.aes_mode = + Some((AesMode::Aes256, vendor_version, compression_method)) + } + _ => { + return Err(ZipError::InvalidArchive("Invalid AES encryption strength")) + } + }; + file.compression_method = compression_method; + } + } + 0x5455 => { + file.extra_fields.push(ExtraField::ExtendedTimestamp( + ExtendedTimestamp::try_from_reader(&mut reader, len)?, + )); + + len_left = 0; + } + _ => {} + } + if len_left > 0 { + reader.seek(SeekFrom::Current(len_left)).await?; + } + } + Ok(()) +} diff --git a/src/spec.rs b/src/spec.rs index 893228e4e..03b15d74c 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -1,3 +1,6 @@ +#[cfg(feature = "tokio")] +use tokio::io::{AsyncRead, AsyncReadExt, AsyncSeek, AsyncSeekExt}; + use crate::result::{ZipError, ZipResult}; use crate::unstable::{LittleEndianReadExt, LittleEndianWriteExt}; use core::mem::size_of_val; @@ -112,6 +115,7 @@ pub struct Zip64CentralDirectoryEndLocator { pub number_of_disks: u32, } +#[cfg(feature = "sync")] impl Zip64CentralDirectoryEndLocator { pub fn parse(reader: &mut T) -> ZipResult { let magic = reader.read_u32_le()?; @@ -140,6 +144,30 @@ impl Zip64CentralDirectoryEndLocator { } } +#[cfg(feature = "tokio")] +impl Zip64CentralDirectoryEndLocator { + pub async fn parse(reader: &mut T) -> ZipResult + where + T: AsyncRead + Unpin, + { + let magic = reader.read_u32_le().await?; + if magic != ZIP64_CENTRAL_DIRECTORY_END_LOCATOR_SIGNATURE { + return Err(ZipError::InvalidArchive( + "Invalid zip64 locator digital signature header", + )); + } + let disk_with_central_directory = reader.read_u32_le().await?; + let end_of_central_directory_offset = reader.read_u64_le().await?; + let number_of_disks = reader.read_u32_le().await?; + + Ok(Self { + disk_with_central_directory, + end_of_central_directory_offset, + number_of_disks, + }) + } +} + pub struct Zip64CentralDirectoryEnd { pub version_made_by: u16, pub version_needed_to_extract: u16, @@ -152,6 +180,7 @@ pub struct Zip64CentralDirectoryEnd { //pub extensible_data_sector: Vec, <-- We don't do anything with this at the moment. } +#[cfg(feature = "sync")] impl Zip64CentralDirectoryEnd { pub fn find_and_parse( reader: &mut T, @@ -227,6 +256,69 @@ impl Zip64CentralDirectoryEnd { } } +#[cfg(feature = "tokio")] +impl Zip64CentralDirectoryEnd { + pub async fn find_and_parse( + reader: &mut T, + nominal_offset: u64, + search_upper_bound: u64, + ) -> ZipResult> + where + T: AsyncRead + AsyncSeek + Unpin, + { + let mut results = Vec::new(); + let mut pos = search_upper_bound; + + while pos >= nominal_offset { + let mut have_signature = false; + reader.seek(tokio::io::SeekFrom::Start(pos)).await?; + if reader.read_u32_le().await? == ZIP64_CENTRAL_DIRECTORY_END_SIGNATURE { + have_signature = true; + let archive_offset = pos - nominal_offset; + + let _record_size = reader.read_u64_le().await?; + let version_made_by = reader.read_u16_le().await?; + let version_needed_to_extract = reader.read_u16_le().await?; + let disk_number = reader.read_u32_le().await?; + let disk_with_central_directory = reader.read_u32_le().await?; + let number_of_files_on_this_disk = reader.read_u64_le().await?; + let number_of_files = reader.read_u64_le().await?; + let central_directory_size = reader.read_u64_le().await?; + let central_directory_offset = reader.read_u64_le().await?; + + results.push(( + Self { + version_made_by, + version_needed_to_extract, + disk_number, + disk_with_central_directory, + number_of_files_on_this_disk, + number_of_files, + central_directory_size, + central_directory_offset, + }, + archive_offset, + )); + } + pos = match pos.checked_sub(if have_signature { + size_of_val(&ZIP64_CENTRAL_DIRECTORY_END_SIGNATURE) as u64 + } else { + 1 + }) { + None => break, + Some(p) => p, + } + } + if results.is_empty() { + Err(ZipError::InvalidArchive( + "Could not find ZIP64 central directory end", + )) + } else { + Ok(results) + } + } +} + pub(crate) fn is_dir(filename: &str) -> bool { filename .chars() diff --git a/src/write.rs b/src/write.rs index 87f3a49e2..168c4abef 100644 --- a/src/write.rs +++ b/src/write.rs @@ -3,6 +3,7 @@ #[cfg(feature = "aes-crypto")] use crate::aes::AesWriter; use crate::compression::CompressionMethod; +#[cfg(feature = "sync")] use crate::read::{sync::find_content, ZipArchive, ZipFile, ZipFileReader}; use crate::result::{ZipError, ZipResult}; use crate::spec;