Commit graph

2161 commits

Author SHA1 Message Date
c51b2f59a3 chore: include build script
Some checks failed
CI / Build and test : windows-latest, stable (push) Has been cancelled
CI / Build and test --all-features: macOS-latest, msrv (push) Has been cancelled
CI / Build and test --all-features: macOS-latest, nightly (push) Has been cancelled
CI / Build and test --all-features: macOS-latest, stable (push) Has been cancelled
CI / Build and test --all-features: ubuntu-latest, msrv (push) Has been cancelled
CI / Build and test --all-features: ubuntu-latest, nightly (push) Has been cancelled
CI / Build and test --all-features: ubuntu-latest, stable (push) Has been cancelled
CI / Build and test --all-features: windows-latest, msrv (push) Has been cancelled
CI / Build and test --all-features: windows-latest, nightly (push) Has been cancelled
CI / Build and test --all-features: windows-latest, stable (push) Has been cancelled
CI / Build and test --no-default-features: macOS-latest, msrv (push) Has been cancelled
CI / Build and test --no-default-features: macOS-latest, nightly (push) Has been cancelled
CI / Build and test --no-default-features: macOS-latest, stable (push) Has been cancelled
CI / Build and test --no-default-features: ubuntu-latest, msrv (push) Has been cancelled
CI / Build and test --no-default-features: ubuntu-latest, nightly (push) Has been cancelled
CI / Build and test --no-default-features: ubuntu-latest, stable (push) Has been cancelled
CI / Build and test --no-default-features: windows-latest, msrv (push) Has been cancelled
CI / Build and test --no-default-features: windows-latest, nightly (push) Has been cancelled
CI / Build and test --no-default-features: windows-latest, stable (push) Has been cancelled
CI / cargo_fmt (push) Has been cancelled
CI / check_minimal_versions (push) Has been cancelled
CI / style_and_docs () (push) Has been cancelled
CI / style_and_docs (--all-features) (push) Has been cancelled
CI / style_and_docs (--no-default-features) (push) Has been cancelled
DevSkim / DevSkim (push) Has been cancelled
Release / Release-plz (push) Has been cancelled
CI / fuzz_read (push) Has been cancelled
CI / fuzz_read_with_no_features (push) Has been cancelled
CI / fuzz_write (push) Has been cancelled
CI / fuzz_write_with_no_features (push) Has been cancelled
2024-12-26 15:27:15 +00:00
473b156e1f feat: add wasm bindings
Some checks are pending
CI / Build and test : windows-latest, stable (push) Waiting to run
CI / Build and test --all-features: macOS-latest, msrv (push) Waiting to run
CI / Build and test --all-features: macOS-latest, nightly (push) Waiting to run
CI / Build and test --all-features: macOS-latest, stable (push) Waiting to run
CI / Build and test --all-features: ubuntu-latest, msrv (push) Waiting to run
CI / Build and test --all-features: ubuntu-latest, nightly (push) Waiting to run
CI / Build and test --all-features: ubuntu-latest, stable (push) Waiting to run
CI / Build and test --all-features: windows-latest, msrv (push) Waiting to run
CI / Build and test --all-features: windows-latest, nightly (push) Waiting to run
CI / Build and test --all-features: windows-latest, stable (push) Waiting to run
CI / Build and test --no-default-features: macOS-latest, msrv (push) Waiting to run
CI / Build and test --no-default-features: macOS-latest, nightly (push) Waiting to run
CI / Build and test --no-default-features: macOS-latest, stable (push) Waiting to run
CI / Build and test --no-default-features: ubuntu-latest, msrv (push) Waiting to run
CI / Build and test --no-default-features: ubuntu-latest, nightly (push) Waiting to run
CI / Build and test --no-default-features: ubuntu-latest, stable (push) Waiting to run
CI / Build and test --no-default-features: windows-latest, msrv (push) Waiting to run
CI / Build and test --no-default-features: windows-latest, nightly (push) Waiting to run
CI / Build and test --no-default-features: windows-latest, stable (push) Waiting to run
CI / cargo_fmt (push) Waiting to run
CI / check_minimal_versions (push) Waiting to run
CI / style_and_docs () (push) Waiting to run
CI / style_and_docs (--all-features) (push) Waiting to run
CI / style_and_docs (--no-default-features) (push) Waiting to run
CI / fuzz_read (push) Blocked by required conditions
CI / fuzz_read_with_no_features (push) Blocked by required conditions
CI / fuzz_write (push) Blocked by required conditions
CI / fuzz_write_with_no_features (push) Blocked by required conditions
DevSkim / DevSkim (push) Waiting to run
Release / Release-plz (push) Waiting to run
2024-12-26 15:22:35 +00:00
Chris Hennick
e074e09b83
chore: release v2.2.2 (#270)
Some checks are pending
CI / Build and test : windows-latest, stable (push) Waiting to run
CI / Build and test --all-features: macOS-latest, msrv (push) Waiting to run
CI / Build and test --all-features: macOS-latest, nightly (push) Waiting to run
CI / Build and test --all-features: macOS-latest, stable (push) Waiting to run
CI / Build and test --all-features: ubuntu-latest, msrv (push) Waiting to run
CI / Build and test --all-features: ubuntu-latest, nightly (push) Waiting to run
CI / Build and test --all-features: ubuntu-latest, stable (push) Waiting to run
CI / Build and test --all-features: windows-latest, msrv (push) Waiting to run
CI / Build and test --all-features: windows-latest, nightly (push) Waiting to run
CI / Build and test --all-features: windows-latest, stable (push) Waiting to run
CI / Build and test --no-default-features: macOS-latest, msrv (push) Waiting to run
CI / Build and test --no-default-features: macOS-latest, nightly (push) Waiting to run
CI / Build and test --no-default-features: macOS-latest, stable (push) Waiting to run
CI / Build and test --no-default-features: ubuntu-latest, msrv (push) Waiting to run
CI / Build and test --no-default-features: ubuntu-latest, nightly (push) Waiting to run
CI / Build and test --no-default-features: ubuntu-latest, stable (push) Waiting to run
CI / Build and test --no-default-features: windows-latest, msrv (push) Waiting to run
CI / Build and test --no-default-features: windows-latest, nightly (push) Waiting to run
CI / Build and test --no-default-features: windows-latest, stable (push) Waiting to run
CI / cargo_fmt (push) Waiting to run
CI / check_minimal_versions (push) Waiting to run
CI / style_and_docs () (push) Waiting to run
CI / style_and_docs (--all-features) (push) Waiting to run
CI / style_and_docs (--no-default-features) (push) Waiting to run
CI / fuzz_read (push) Blocked by required conditions
CI / fuzz_read_with_no_features (push) Blocked by required conditions
CI / fuzz_write (push) Blocked by required conditions
CI / fuzz_write_with_no_features (push) Blocked by required conditions
DevSkim / DevSkim (push) Waiting to run
Release / Release-plz (push) Waiting to run
2024-12-16 16:13:35 +00:00
Richard Ivánek
33c71ccc80
fix: rewrite the EOCD/EOCD64 detection to fix extreme performance regression (#247)
* fix: resolve clippy warning in nightly

* wip: major rework of cde location

* wip: rework CDE lookup

* refactor: magic finder, eocd lookup retry

* wip: handle empty zips

* fix: satisfy tests, add documentation

* chore: remove unused dependencies

* feat: support both zip32 and zip64 comments

* feat: add zip64 comment functions to ZipWriter

* fix: first pass on maintainer comments

* fix: continue searching for EOCD when the central directory is invalid

* chore: satisfy clippy lints

* chore: satisfy style_and_docs

* feat: support both directions in MagicFinder, correctly find first CDFH

* fix: more checks to EOCD parsing, move comment size error from parse to write

* fix: use saturating add when checking eocd64 record_size upper bound

* fix: correctly handle mid window offsets in forward mode

* fix: compare maximum possible comment length against file size, not search region end

* feat: handle zip64 detection as a hint

* fix: detect oversized central directories when locating EOCD64

* fix: oopsie

---------

Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
Co-authored-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-12-16 03:32:55 +00:00
Mrmaxmeier
810d18a9a1
deps: Relax dependency versions (#243)
* CI: Add -Zminimal-versions job

* Bump anyhow dev-dep to fix build with -Zminimal-versions

* Relax dependency bounds

These relaxed bounds don't impact existing builds as they're all SemVer
compatible. Specifying lower bounds allows projects with dependencies
that pin
these to lower versions do build without version resolution conflicts.

* Cargo.toml: elide .0 patch versions

---------

Co-authored-by: Your Name <you@example.com>
Co-authored-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-11-25 14:33:05 +00:00
Chris Hennick
2c03abc965
chore: release v2.2.1 (#264) 2024-11-21 13:42:56 +00:00
wiiznokes
591ce5d044
fix: remove executable bit (#238)
Co-authored-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-11-19 19:56:41 +00:00
Radmir
ff877df425
fix(lzma): fixed panic in case of invalid lzma stream (#259)
Co-authored-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-11-19 19:55:47 +00:00
ardurin
0ea2744c89
Add function to raw copy files and update metadata (#260)
Co-authored-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-11-19 19:54:32 +00:00
Chris Hennick
a5722e6de8
build(#237): Don't implicitly enable flate2/any_impl, so that error when missing a back-end is more readable (#244)
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-11-19 18:56:06 +00:00
David Caldwell
de8e3d3ba5
Use the tempfile crate instead of the tempdir crate (which is deprecated) (#254)
https://github.com/rust-lang-deprecated/tempdir?tab=readme-ov-file#deprecation-note

Co-authored-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-11-19 18:52:32 +00:00
David Caldwell
73143a0ad6
perf: Faster cde rejection (#255)
* Use the tempfile crate instead of the tempdir crate (which is deprecated)

https://github.com/rust-lang-deprecated/tempdir?tab=readme-ov-file#deprecation-note

* perf: Add benchmark that measures the rejection speed of a large non-zip file

* perf: Speed up non-zip rejection by increasing END_WINDOW_SIZE

I tested several END_WINDOW_SIZEs across 2 machines:

Machine 1: macOS 15.0.1, aarch64 (apfs /tmp)
512:   test parse_large_non_zip  ... bench:  30,450,608 ns/iter (+/- 673,910)
4096:  test parse_large_non_zip  ... bench:   7,741,366 ns/iter (+/- 521,101)
8192:  test parse_large_non_zip  ... bench:   5,807,443 ns/iter (+/- 546,227)
16384: test parse_large_non_zip  ... bench:   4,794,314 ns/iter (+/- 419,114)
32768: test parse_large_non_zip  ... bench:   4,262,897 ns/iter (+/- 397,582)
65536: test parse_large_non_zip  ... bench:   4,060,847 ns/iter (+/- 280,964)

Machine 2: Debian testing, x86_64 (tmpfs /tmp)
512:   test parse_large_non_zip  ... bench:  65,132,581 ns/iter (+/- 7,429,976)
4096:  test parse_large_non_zip  ... bench:  14,109,503 ns/iter (+/- 2,892,086)
8192:  test parse_large_non_zip  ... bench:   9,942,500 ns/iter (+/- 1,886,063)
16384: test parse_large_non_zip  ... bench:   8,205,851 ns/iter (+/- 2,902,041)
32768: test parse_large_non_zip  ... bench:   7,012,011 ns/iter (+/- 2,222,879)
65536: test parse_large_non_zip  ... bench:   6,577,275 ns/iter (+/- 881,546)

In both cases END_WINDOW_SIZE=8192 performed about 6x better than 512 and >8192
didn't make much of a difference on top of that.

* perf: Speed up non-zip rejection by limiting search for EOCDR.

I benchmarked several search sizes across 2 machines
(these benches are using an 8192 END_WINDOW_SIZE):

Machine 1: macOS 15.0.1, aarch64 (apfs /tmp)
whole file:   test parse_large_non_zip              ... bench:   5,773,801 ns/iter (+/- 411,277)
last 128k:    test parse_large_non_zip              ... bench:      54,402 ns/iter (+/- 4,126)
last 66,000:  test parse_large_non_zip              ... bench:      36,152 ns/iter (+/- 4,293)

Machine 2: Debian testing, x86_64 (tmpfs /tmp)
whole file:   test parse_large_non_zip              ... bench:   9,942,306 ns/iter (+/- 1,963,522)
last 128k:    test parse_large_non_zip              ... bench:      73,604 ns/iter (+/- 16,662)
last 66,000:  test parse_large_non_zip              ... bench:      41,349 ns/iter (+/- 16,812)

As you might expect these significantly increase the rejection speed for
large non-zip files.

66,000 was the number previously used by zip-rs. It was changed to zero in
7a55945743.

128K is what Info-Zip uses[1]. This seems like a reasonable (non-zero)
choice for compatibility reasons.

[1] Info-zip is extremely old and doesn't not have an official git repo to
    link to. However, an unofficial fork can be found here:
    bb0c4755d4/zipfile.c (L4073)

---------

Co-authored-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-11-19 18:49:35 +00:00
dependabot[bot]
b8257f81bd
chore(deps): update thiserror requirement from 1.0.63 to 2.0.3 (#258)
Updates the requirements on [thiserror](https://github.com/dtolnay/thiserror) to permit the latest version.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.63...2.0.3)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-11-19 18:20:39 +00:00
Chris Hennick
8abbf0e931
ci(fuzz): Switch to alf for faster fuzzing (#245)
* test(fuzz): Migrate to afl++ for fuzzing

* build: Exclude new fuzz binaries

* chore: Fix new warning

* ci: Use cargo action for format check

* deps: Update constant_time_eq and flate2

* ci: Bug fix for file paths

* ci: Bug fix: working directory is parent of repository root

* ci: Bug fix: remove stray `cd` commands

* ci: Bug fix? Make paths explicitly descend from workspace root

* ci: Bug fix? Assume github.workspace is the repo root

* test(fuzz): Commit files that were previously missing

* ci(fuzz): Bug fix for fuzz_write_with_no_features

* ci(fuzz): Bug fix: no -V arg for cmin

* ci(fuzz): Bug fix: no -a arg for cmin

* Bug fix: replace colons with dashes in filenames

* style: Fix 2 clippy warnings

* style: Fix another clippy warning in some configs

* ci(fuzz): Enable renaming in all fuzz jobs

* ci(fuzz): Fix: need to rename files in multiple dirs

Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>

* ci(fuzz): Install `rename` tool

* ci(fuzz): Fix redundant steps and too-late install of `rename`

* ci(fuzz): fix? replace multiple colons

---------

Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-11-19 14:25:55 +00:00
Richard Ivánek
1f2957db1f
fix: resolve new clippy warnings on nightly (#262) 2024-11-18 22:31:26 +00:00
Richard Ivánek
06632924e8
fix: resolve clippy warning in nightly (#252) 2024-10-21 05:05:49 +00:00
Chris Hennick
6d3945645b
chore: release (#234) 2024-08-19 20:27:21 +00:00
nick
af33ed343d
feat: Expose ZipArchive::central_directory_start (#232) 2024-08-11 12:00:08 +00:00
Shun Sakai
3f6768ec5a
docs: Update list of supported features (#230) 2024-08-05 17:15:45 +00:00
Chris Hennick
3a427c4f78
deps: Update dependencies with cargo upgrade 2024-07-31 19:55:23 -07:00
Chris Hennick
beab418695
chore: release (#229) 2024-07-31 05:55:59 +00:00
Chris Hennick
f803fa0197
test: (#33) Verify that data_start is correct when reading an alignment-padded file (#228)
* test: Add test that `data_start` is correctly detected while reading

* chore: Fix imports
2024-07-29 16:23:32 +00:00
Chris Hennick
6d8ab6224b
fix: (#33) Rare combination of settings could lead to writing a corrupt archive with overlength extra data, and data_start locations when reading the archive back were also wrong (#221)
* fix: Rare combination of settings could lead to writing a corrupt archive with overlength extra data

* fix: Previous fix was breaking alignment

* style: cargo fmt --all

* fix: ZIP64 header was being written twice

* style: cargo fmt --all

* ci(fuzz): Add check that file-creation options are individually valid

* fix: Need to update extra_data_start in deep_copy_file

* style: cargo fmt --all

* test(fuzz): fix bug in Arbitrary impl

* fix: Cursor-position bugs when merging archives or opening for append

* fix: unintended feature dependency

* style: cargo fmt --all

* fix: merge_contents was miscalculating new start positions for absorbed archive's files

* fix: shallow_copy_file needs to reset CDE location since the CDE is copied

* fix: ZIP64 header was being written after AES header location was already calculated

* fix: ZIP64 header was being counted twice when writing extra-field length

* fix: deep_copy_file was positioning cursor incorrectly

* test(fuzz): Reimplement Debug so that it prints the method calls actually made

* test(fuzz): Fix issues with `Option<&mut Formatter>`

* chore: Partial debug

* chore: Revert: `merge_contents` already adjusts header_start and data_start

* chore: Revert unused `mut`

* style: cargo fmt --all

* refactor: eliminate a magic number for CDE block size

* chore: WIP: fix bugs

* refactor: Minor refactors

* refactor: eliminate a magic number for CDE block size

* refactor: Minor refactors

* refactor: Can use cde_start_pos to locate ZIP64 end locator

* chore: Fix import that can no longer be feature-gated

* chore: Fix import that can no longer be feature-gated

* refactor: Confusing variable name

* style: cargo fmt --all and fix Clippy warnings

* style: fix another Clippy warning

---------

Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-07-29 02:24:07 +00:00
Chris Hennick
fd5f804072
test(fuzz): Consume self, and add initial junk (#226) 2024-07-28 03:38:34 +00:00
Chris Hennick
3ecd65176c
refactor: Eliminate some magic numbers and unnecessary path prefixes (#225)
* refactor: eliminate a magic number for CDE block size

* refactor: Minor refactors

* refactor: Can use cde_start_pos to locate ZIP64 end locator

* chore: Fix import that can no longer be feature-gated

* chore: Fix import that can no longer be feature-gated
2024-07-28 01:43:44 +00:00
Chris Hennick
a29b860395
test(fuzz): Make cargo fuzz fmt fuzz_write output more reliably equivalent to the code path it follows (#224) 2024-07-26 21:42:03 +00:00
Chris Hennick
546e49d7f2
docs: Update pull_request_template.md
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-07-20 20:44:42 -07:00
Chris Hennick
50fd94fe4e
docs: Update pull_request_template.md
Commit messages in PR no longer need to follow ConCom, since we now squash-merge PRs.

Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-07-20 20:39:54 -07:00
Chris Hennick
8fb107ad5e
chore: release (#222) 2024-07-20 16:31:46 +00:00
Danny McClanahan
a7c1230dfa
publicly export and document the zip64 threshold constants (#79)
- add doctest for ZIP64_BYTES_THR
2024-07-20 01:52:06 +00:00
Chris Hennick
a60bd79826
Merge pull request #210 from a1phyr/multiple_refactors
Multiple refactors
2024-07-20 01:29:39 +00:00
Chris Hennick
7471cf526f
refactor: change invalid_state() return type to io::Result<T>
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-07-19 13:32:23 -07:00
Chris Hennick
9caa3b678f
Merge pull request #194 from zip-rs/release-plz-2024-06-15T04-17-17Z
chore: release v2.1.4
2024-07-19 05:50:09 +00:00
Chris Hennick
8b11361b9e
chore: release 2024-07-18 15:34:03 -07:00
Chris Hennick
55c2c64249 ci(fuzz): Set max length closer to current corpus entries' length 2024-07-18 22:18:58 +00:00
Chris Hennick
193bbe125b fix(#215): Upgrade to deflate64 0.1.9 2024-07-18 21:06:33 +00:00
Chris Hennick
4e971d07ab Commit unfinished corpus 2024-07-18 21:02:19 +00:00
Chris Hennick
c14986806a Fix divergence from origin/master 2024-07-18 21:02:19 +00:00
Chris Hennick
81b5fb6088 Update fuzz_write corpus to use only smaller entries 2024-07-18 21:02:16 +00:00
Chris Hennick
6106a2bf0b
Merge pull request #201 from nichmor/fix/soft-links-should-remain-the-same
fix: soft links should remain the same
2024-07-18 17:26:17 +00:00
Chris Hennick
03dd55773e
Merge pull request #218 from zip-rs/fuzz-write-no-feat-40m
ci(fuzz): Run fuzz_write_with_no_features only 40m times
2024-07-18 01:11:45 +00:00
Chris Hennick
e48686a9d2
ci(fuzz): Run fuzz_write_with_no_features only 40m times 2024-07-17 14:31:10 -07:00
Chris Hennick
6b797b1ba9
Merge pull request #64 from zip-rs/oldpr368
feat: Added function to get if a file is encrypted or not
2024-07-17 17:25:50 +00:00
Chris Hennick
5632e7f25a
Merge pull request #69 from zip-rs/oldpr369
feat: Add by_name_seek() for Stored zips
2024-07-17 17:25:19 +00:00
Chris Hennick
b8c145717b
Merge pull request #212 from a1phyr/improve_unsafe_code
refactor: Improve `FixedSizeBlock`
2024-07-17 17:24:58 +00:00
Chris Hennick
97d0a345f1
Merge pull request #66 from zip-rs/oldpr373
feat: Add ZipWriter::set_file_metadata()
2024-07-17 17:23:33 +00:00
Chris Hennick
fd119850e8
Merge pull request #206 from zip-rs/dependabot/github_actions/dependabot/fetch-metadata-2.2.0
ci(deps): bump dependabot/fetch-metadata from 2.1.0 to 2.2.0
2024-07-17 17:23:07 +00:00
Chris Hennick
5cfae807f5
Merge pull request #216 from zip-rs/dependabot/cargo/fuzz/tikv-jemallocator-0.6.0
test(fuzz)(deps): update tikv-jemallocator requirement from 0.5.4 to 0.6.0 in /fuzz
2024-07-17 17:22:39 +00:00
Chris Hennick
97bb7ad563
Merge pull request #217 from zip-rs/fuzz-progressive-sizes
ci(fuzz): Update fuzz corpora with WIP versions
2024-07-17 02:01:57 +00:00
Chris Hennick
27ddf22677 Merge remote-tracking branch 'origin/fuzz-progressive-sizes' into fuzz-progressive-sizes 2024-07-16 21:50:50 +00:00