Commit graph

113 commits

Author SHA1 Message Date
Nick Babcock
03613cb56e Fix capacity overflow on invalid zips reads
Preemptively allocating structures with the number of reported files can
lead to trouble as an invalid zip can still have a valid central
directory end that is fed into a `with_capacity` causing it to overflow.

This commit introduces a heuristic that will use the reported number of
files as long as the number is less than the cde offset.

Benchmarks were unaffected by this change.
2022-04-25 21:01:56 -05:00
Jack Fletcher
a91736a356 Merge branch 'feature/supported-methods' into feature/end-to-end-all-methods 2022-01-30 21:26:45 +00:00
Jack Fletcher
0330f4707b Update end to end methods import 2022-01-30 20:50:12 +00:00
Lireer
49f7501c5f add and use AES associated constant 2022-01-30 15:10:07 +01:00
Jack Fletcher
5aa0b601c9 Add expected data param to test fn check_archive_file 2022-01-27 00:51:19 +00:00
Jack Fletcher
4cb2067019 Update test helper function names 2022-01-27 00:12:17 +00:00
Jack Fletcher
161308c673 Add comments to test helpers 2022-01-26 23:47:40 +00:00
Jack Fletcher
6711ac91a8 Fix linter warnings 2022-01-26 22:21:17 +00:00
Lireer
2e06844429 fix clippy warning and shorten links in tests 2022-01-26 14:53:19 +01:00
Lireer
c17df86dbf test decryption of aes encrypted files 2022-01-25 22:07:53 +01:00
Jack Fletcher
6dcadff21d Add test changes from other branch 2022-01-24 20:32:22 +00:00
Alexander Zaitsev
e636399935 fix: fix all Clippy warnings
- some warnings are muted since fixing them right now can be a breaking
  API change
- fix Clippy warns in the src, examples and tests

Tested:
- Local test run
2022-01-23 18:54:43 +03:00
Alexander Zaitsev
061cdf149f fix: fix Clippy warnings
- fix a bunch of Clippy warnings
- fix some usages of assert! (change to assert_ne)

Tested:
- Local unit-tests run
2022-01-23 17:35:27 +03:00
Alexander Zaitsev
b053eb0f2c feat: add tests
- add tests for the large header

Tested:
- Local run
2022-01-23 02:43:04 +03:00
Marli Frost
61de5d51ac
feat: constant for handling missing password 2021-06-04 18:42:20 +01:00
Marli Frost
3fd44ffd5d
Merge pull request #200 from qu1x/support-extra-field 2021-05-11 11:18:17 +01:00
zhanghar
10da026ff6 feat: support append to an existing archive 2020-12-23 14:37:09 -05:00
Rouven Spreckels
d53c8bdf07 Merge branch 'master' into support-extra-field 2020-11-16 11:57:08 +01:00
Plecra
f5061c25e9
Merge pull request #178 from davide-romanini/forgive-after-comment-junk
Allow for garbage after comment data
2020-11-15 21:32:38 +00:00
Plecra
4d8a068495
Merge pull request #98 from robmv/feature-copy
Add new APIs that allow copying zip file entries between zip files
2020-11-15 16:20:53 +00:00
Marli Frost
105368aebf docs: improve explanation of new APIs 2020-11-10 16:37:14 +00:00
Robert Marcano
5843d17d4c Add new APIs that allow copying zip file entries between zip files
The copy is done directly using the raw compressed data, avoiding
decompression and recompression.
2020-11-03 12:57:58 -04:00
Rouven Spreckels
9397773a32 Add ZIP64 write support. 2020-10-03 11:05:23 +02:00
Rouven Spreckels
365f139206 Use io::Write for extra field. 2020-09-18 16:15:41 +02:00
Rouven Spreckels
a191c4b435 Support extra field. 2020-09-16 13:59:43 +02:00
Marli Frost
a35c8ffa91
chore: update tests to use preferred method 2020-09-12 10:51:43 +01:00
Marli Frost
5e5bd86915
refactor: remove extra variants from ZipError 2020-09-10 10:21:47 +01:00
Marli Frost
25d479e65d
chore: remove dead code for 0.5.7 2020-08-25 22:05:56 +01:00
Davide Romanini
5eefdf8271 add test for handling comment garbage 2020-08-19 18:53:58 +02:00
Marli Frost
0b46263eac
fix: ZipArchive::extract incomplete
Path sanitization needs to be implemented before we can make this public
2020-08-19 15:12:35 +01:00
Marli Frost
4eba55cb7a
refactor: use deprecated API in tests 2020-08-19 13:59:48 +01:00
nickbabcock
ef5ce23d85 Fix overflow in directory counts of ZIP64 files 2020-08-10 21:22:49 -05:00
Plecra
510f1cce7b
Merge pull request #116 from zacps/extract
Add function to extract a all files in an archive to a directory
2020-06-26 09:32:46 +01:00
Benjamin Richner
2730ca7e76 Turned clumsy if statements into matcher clause 2020-06-23 21:44:26 +02:00
Benjamin Richner
9e2b14f368 Create meaningful panic messages in ZipCrypto test 2020-06-23 21:35:59 +02:00
Benjamin Richner
4737f145ff Use b prefix instead of as_bytes() 2020-06-23 21:28:34 +02:00
Benjamin Richner
dbae003aca Merge improvements from master 2020-06-23 20:44:18 +02:00
Marli Frost
2f0e14574e refactor: make crate 1.34.0 compatible 2020-06-23 16:21:10 +01:00
Jeremy Aube
d382f04e5a Change default comment to String::new() and fixed tests 2020-06-21 12:38:36 -04:00
Benjamin Richner
493afdbee1 run cargo fmt 2020-06-21 17:47:08 +02:00
Benjamin Richner
bd3ed222ac Merge improvements from master 2020-06-21 17:43:40 +02:00
Zac Pullar-Strecker
c074a3090c run rustfmt 2020-06-16 14:45:36 +12:00
Zac Pullar-Strecker
178699d2d5 Add function to extract a all files in an archive to a directory 2020-06-16 14:38:35 +12:00
Ryan Levick
ebb07348ee Run cargo fmt 2020-06-15 10:44:39 +02:00
Benjamin Richner
402ecb1e34 Add ZipCrypto unit test 2020-05-21 23:54:12 +02:00
Manu Thambi
91c93579f2 Added ZipArchive::file_names() method to return an iterator of all the file names
in the archive.

Using ZipArchive::by_index() to obtain a list of files is slow, if the files are
not read, because it creates the decompressor internally before returning ZipFile.

Fixes #122
2020-01-14 09:58:12 -05:00
Lachezar Lechev
29517e9a6b
run cargo fix --edition-idioms and manually fix other things 2019-11-11 09:20:31 +02:00
Lachezar Lechev
99dba6b397
run cargo fix --edition 2019-11-11 08:58:59 +02:00
Michael Lamparski
907e13b5b6 impl Default for write::FileOptions 2019-07-22 13:24:34 -04:00
Mathijs van de Nes
5d0f198124 Rename all tests in tests folder
Using the name 'main' was confusing
2019-04-06 17:59:04 +02:00