Commit graph

99 commits

Author SHA1 Message Date
Chris Hennick
eacc320fe0
chore: Add check for wrong-length blocks, and incorporate fixed-size requirement into the trait name 2024-06-02 21:48:21 -07:00
Chris Hennick
326b2c4582
Revert macro changes
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-05-24 13:15:58 -07:00
Chris Hennick
3af70176e3
Remove an unused macro branch
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-05-24 13:11:07 -07:00
Chris Hennick
01bb162456
Remove an unused macro branch
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-05-24 13:10:44 -07:00
Chris Hennick
1bb0b14456
style: Fix cargo fmt check
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-05-24 13:03:00 -07:00
Chris Hennick
18760e9f9d
Switch to debug_assert! for an assert! involving only constants
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-05-24 12:58:36 -07:00
Chris Hennick
848309a944
Switch to debug_assert! for an assert! involving only constants
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-05-24 12:58:19 -07:00
Chris Hennick
9722dd31e9
Return error if file comment is too long
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
2024-05-24 12:57:34 -07:00
Danny McClanahan
d81382b29a
revert limit for search_lower_bound to fix benchmark 2024-05-24 09:00:33 -04:00
Danny McClanahan
a509efc28a
review comments 3 2024-05-24 08:26:38 -04:00
Danny McClanahan
4a784b5636
interpose ZipRawValues into ZipFileData 2024-05-24 07:58:05 -04:00
Danny McClanahan
7c2474f80c
go into_boxed_slice() earlier 2024-05-24 07:54:40 -04:00
Danny McClanahan
d852c222fc
review comments 1 2024-05-24 07:54:40 -04:00
Danny McClanahan
a7fd5874cf
reduce visibility for all the blocks 2024-05-24 07:54:40 -04:00
Danny McClanahan
21d07e192c
add ExtraFieldMagic and Zip64ExtraFieldBlock 2024-05-24 07:54:39 -04:00
Danny McClanahan
8fbc4039a8
lean more on the ::MAGIC trait constants 2024-05-24 07:54:04 -04:00
Danny McClanahan
e1c92e2f21
make SIG_BYTES const 2024-05-24 07:52:31 -04:00
Danny McClanahan
03c92a1184
add to_and_from_le! macro 2024-05-24 07:52:31 -04:00
Danny McClanahan
83cdbadae8
make window size assertions much less complex with Magic 2024-05-24 07:52:31 -04:00
Danny McClanahan
7eb5907622
remove a lot of boilerplate for Block impls 2024-05-24 07:52:31 -04:00
Danny McClanahan
3fa0d84554
make Magic into a wrapper struct 2024-05-24 07:52:31 -04:00
Danny McClanahan
ea308499af
bulk parsing and bulk writing
- use blocks for reading individual file headers
- remove unnecessary option wrapping for stream entries
- create Block trait
- add coerce method to reduce some boilerplate
- add serialize method to reduce more boilerplate
- use to_le! and from_le!
- add test case
- add some docs
- rename a few structs to clarify zip32-only
2024-05-24 07:52:25 -04:00
Danny McClanahan
7a55945743
add benchmarks 2024-05-24 07:39:54 -04:00
Chris Hennick
267ab432cf
chore: partial revert - only &str has chars(), but Box<str> should auto-deref 2024-05-15 16:51:12 -07:00
Chris Hennick
d78f127039
chore: contains_key needs a Box<str>, so generify is_dir to accept one 2024-05-15 16:49:05 -07:00
Chris Hennick
b7ac989013
refactor: is_dir only needs to look at the filename 2024-05-15 16:44:59 -07:00
Chris Hennick
bd473ef75b
perf: Use boxed slice for archive comment, since it can't be concatenated 2024-05-08 15:36:12 -07:00
Chris Hennick
eb063ad432
perf: Optimize for the fact that false signatures can't overlap with real ones 2024-05-08 10:59:32 -07:00
Chris Hennick
e1ef3fc65c
fix: file paths shouldn't start with slashes (#102) 2024-05-06 10:52:52 -07:00
Chris Hennick
52375437dc
fix: Process ZIP files with up to a 65,978-byte comment (https://github.com/zip-rs/zip-old/issues/183) 2024-05-05 19:48:32 -07:00
Chris Hennick
1b2c42b199
style: cargo fmt --all 2024-05-03 15:18:31 -07:00
Chris Hennick
74e76a94ca
chore: Refactor: can short-circuit handling of paths that start with MAIN_SEPARATOR, no matter what MAIN_SEPARATOR is 2024-05-03 15:01:43 -07:00
Chris Hennick
2adbbccb82
perf: Quick filter for paths that contain "/../" or "/./" or start with "./" or "../" 2024-05-03 14:59:35 -07:00
Chris Hennick
0fe12b2ec9
chore: Bug fix: non-canonical path detection when MAIN_SEPARATOR is not slash or occurs twice in a row 2024-05-03 14:34:05 -07:00
Chris Hennick
5cd448802f
chore: Bug fix: must recreate if . or .. is a path element 2024-05-03 14:31:32 -07:00
Chris Hennick
001967186a
perf: Fast handling for separator-free paths 2024-05-03 14:28:14 -07:00
Chris Hennick
6184232e19
perf: Speed up logic if main separator isn't '/' 2024-05-03 14:11:03 -07:00
Chris Hennick
22e8fdbf58
chore: Bug fix 2024-05-03 14:06:48 -07:00
Chris Hennick
753eedb3a7
perf: Drop normalized_components slightly sooner when not using it 2024-05-03 14:06:29 -07:00
Chris Hennick
efbea6f747
perf: Speed up path_to_string in cases where the path is already in the proper format 2024-05-03 14:05:39 -07:00
Chris Hennick
84ae5fc157
refactor: Remove byteorder dependency (#83) 2024-05-02 17:50:27 -07:00
Chris Hennick
42972297f1
fix: Rare bug where find_and_parse would give up prematurely on detecting a false end-of-CDR header 2024-04-29 13:18:17 -07:00
Chris Hennick
e412d8b6df
Restore support for Path and fix handling of ".." 2024-04-20 14:05:11 -07:00
Chris Hennick
5e03f43f9a Fix failing tests other than deflate64 bug 25 2024-03-07 15:16:04 -08:00
Chris Hennick
2407ef95c6
Fixes and refactors for no-features build 2023-05-30 18:17:59 -07:00
Chris Hennick
dc351196e2
Bug fix: don't allow writing files with certain ZIP64 magic strings in their names 2023-05-11 18:52:41 -07:00
Chris Hennick
ad26a3f7f9
Bug fix 2023-05-11 09:39:18 -07:00
Chris Hennick
2ad4c20681
Reformat and fix Clippy warning 2023-05-11 09:35:12 -07:00
Chris Hennick
8c6816fb33
Bug fixes: file can't be ZIP64 if CDR start is after CDR end 2023-05-11 09:33:06 -07:00
Mikael Pettersson
3fc54cf68c feat: Detect insufficient Dir record size
- Per zip spec 4.4.1.4 (https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT)
- If a CentralDirectoryEnd record field cannot hold the
  required data, a ZIP64 record must exist and the
  field will be set to -1(0xFFFF || 0xFFFFFFFF)
- Previously these archives were incorrectly detected as multi-disk
2023-01-30 11:13:01 +01:00