History log of /system/core/libziparchive/zip_archive_test.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
5c39aa53a9ec87e0fbbd56a3cfa7d7c0906db5bf 27-Dec-2017 Narayan Kamath <narayan@google.com> Merge "zip_archive: Fix a few more badly written tests." am: 93d344d98c
am: 000e0bfff4

Change-Id: I6af4ce2a977e0fbc21974e8e80516fb39ec8156a
c36b80928bf31ae6c13b72704de7c71e588b4b28 22-Dec-2017 Narayan Kamath <narayan@google.com> zip_archive: Fix a few more badly written tests.

Fix failures in DataDescriptor related tests due to to a bad call to
SetZipString (undefined behaviour). Also fix a typo in the test for
invalid descriptors, we were asserting things on the wrong array.

Test: zip_archive_test
Change-Id: I8c9a632443fdf1d5c115670d6e9317e1f4bf6ef4
/system/core/libziparchive/zip_archive_test.cc
47ede5466a311e1ed251d11e95d2a1168c8d6572 22-Dec-2017 Narayan Kamath <narayan@google.com> Merge "zip_archive: Fix tests broken by 1f93d71022cca7bb6bb9eec49." am: 492de535c4
am: fede183c53

Change-Id: Ib1e16a1b0799ffe88b822b04d3231c4d30f77917
f37bb8e45b302091932a7a169c26146a1254aaff 21-Dec-2017 Narayan Kamath <narayan@google.com> zip_archive: Fix tests broken by 1f93d71022cca7bb6bb9eec49.

Moving to std::hash changed iteration order but these tests should
not have relied on hash_map iteration order anyway.

Test: zip_archive_test

Change-Id: I712bf2307c8770f03ea6f074bfc506a40cdcb066
/system/core/libziparchive/zip_archive_test.cc
70f5571a9a950a2b98d07c99a6f8d60b50fe4afd 01-Nov-2017 Narayan Kamath <narayan@google.com> resolve merge conflicts of 5ab03cb41 to oc-mr1-dev-plus-aosp

Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ic749614fb03d60d6cc7e0eb04bb67102e572e9f2
2d1e23f5d6cd6424a261dae5b261197f3611290e 30-Oct-2017 Narayan Kamath <narayan@google.com> zip_archive: Allow crc_out to be nullptr in Inflate.

Only compute the crc32 if required. In addition :
- Add unit tests for Inflate that cover this addition.
- Fix an inconsistency in return codes that was revealed
by this new test.

Bug: 35246701
Test: zip_archive_tests
Test: make; zipalign.
Merged-In: I31d7554378f94fc8995f707471d57cb98311e2c2
Change-Id: I05111bfa665c610f93d1c1dee987a509bf87aa65
/system/core/libziparchive/zip_archive_test.cc
c1a56dcab711a7ee238c0af865920ca51b1408a6 09-Aug-2017 Narayan Kamath <narayan@google.com> zip_archive: reject files that don't start with an LFH signature.

Bug: 64211847
Test: zip_archive_test

Change-Id: I275e7c4da05ceeb20401b560c72294f29ef63642
/system/core/libziparchive/zip_archive_test.cc
cd997e609405cfd6b1f82a1f849f98352b12ae72 30-Jun-2017 Jiyong Park <jiyong@google.com> Ran clang-format on libziparchive sources and headers

Test: build aosp_arm
Change-Id: I469b82b68f2c457f480fb9cd9da2026672985ce3
/system/core/libziparchive/zip_archive_test.cc
9e020e2d117ac389387743c22a30f049c39970c7 10-Oct-2016 Tianjie Xu <xunchang@google.com> Check filename memory bound when parsing ziparchive

Add a check to ensure the filename boundary doesn't exceed the mapped
memory region. Also add the corresponding unit test.

Bug: 28802225
Test: New unit test passes.
Merged-In: Ibf543a7da3d7898952e9eb332c84cdfc67cf5aa4
Change-Id: Ibf543a7da3d7898952e9eb332c84cdfc67cf5aa4
(cherry picked from commit bcc4431f240d1ee5bc89c6ab41542e096e07c48c)
/system/core/libziparchive/zip_archive_test.cc
fba1a36fd912963a838bcf992f898bc5e9370b63 21-Sep-2016 Tianjie Xu <xunchang@google.com> Fix out of bound access in libziparchive

The boundary check of an invalid EOCD record may succeed due to the
overflow of uint32_t. Fix the check and add a unit test.

Test: Open the crash.apk and libziparchive reports the offset error as expected.

Bug: 31251826
Merged-In: I1d8092a19b73886a671bc9d291cfc27d65e3d236
Change-Id: I1d8092a19b73886a671bc9d291cfc27d65e3d236
(cherry picked from commit ae8180c06dee228cd1378c56afa6020ae98d8a24)
/system/core/libziparchive/zip_archive_test.cc
1ef9d2dfbefde23e57eb4e4416644ff7f29c35da 15-Jun-2017 Narayan Kamath <narayan@google.com> zip_archive_test: compare error codes directly.

Make them available to tests so that they can compare values
directly instead of comparing error code strings.

Test: zip_archive_test
Change-Id: I1c78c24651ff7549b5125a49a4e67bbd8295c617
/system/core/libziparchive/zip_archive_test.cc
162b70580154b2dac22ed82caf132b9fd571eb6b 05-Jun-2017 Narayan Kamath <narayan@google.com> zip_archive: validate data descriptor contents.

- Ensure that the compressed and uncompressed lengths in the data
descriptor match those in the central directory.

- Calculate CRCs for compressed entries and ensure that those CRCs
match the information in the central directory / data descriptor.
This is currently guarded by a flag and will be turned on at a
later stage.

- Finally, always trust the LFH when it comes to indicating the
existence of a data descriptor. We no longer require this info to
match the central directory to bring this in line with other zip
processing tools. (see NOTE in the included change).

Bug: 62047801
Test: zip_archive_test
Change-Id: Icceea66a8b1937c08a4af9aee97bc77ad7218c0f
/system/core/libziparchive/zip_archive_test.cc
18c25920c285bf2894b5a05868b79f1202c3a264 30-Sep-2016 Tianjie Xu <xunchang@google.com> Add functions in recovery/minzip to libziparchive

Add two functions libziparchive that libminzip has. And create
corresponding unit tests.
1. Open a zip archive from a memory mapped region.
2. A new writer that takes a call back function pointer.
(Used by the OTA updater to stream the data.)

Test: Unit tests passed
Bug: 19472796
Change-Id: I2b2daec71174afe221030357e39bff5faea51e72
/system/core/libziparchive/zip_archive_test.cc
8e6f7227641e05dccfc29dad62e29e730ff8f5ca 09-Feb-2016 Yabin Cui <yabinc@google.com> libziparchive: port unit tests to darwin and windows.

Also use ReadFully to replace read, because read can
return reading bytes less than requested. And use
WriteFully to replace write.

Bug: 26962895
Change-Id: Iff0b2bc6d925619a537f7fef682c2a7ad89a2dc2
/system/core/libziparchive/zip_archive_test.cc
e6884ce56f07933d7292eb0ada1ff752f9c69e7a 10-Nov-2015 Christopher Ferris <cferris@google.com> Add a ZipArchiveStreamEntry class.

This allows someone to stream the data out of a zip archive
instead of extracting to a file or to memory.

Included in this change is a small cleanup of the makefile.

Change-Id: I8b679a679c3502ff4ea0bc4f9e918303657fa424
/system/core/libziparchive/zip_archive_test.cc
4f71319df011d796a60a43fc1bc68e16fbf7d321 05-Dec-2015 Elliott Hughes <enh@google.com> Track rename of base/ to android-base/.

Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
/system/core/libziparchive/zip_archive_test.cc
0e99a2f79ae3831d8bb749e470b3d3217083b015 17-Jul-2015 beonit <beonit@gmail.com> libziparchive: fix calculation of mod_time.

Take mod_date into account as well, and fixes the issue where
all entries had creation dates in 1979.

Signed-off-by: beonit <beonit@gmail.com>
Change-Id: Id101794fa08218d15f2d1ba4e4a313c1807ea7aa
/system/core/libziparchive/zip_archive_test.cc
07447544adbde8f688806b43f47c182eaeda4bb3 25-Jun-2015 Yusuke Sato <yusukes@google.com> Rename ZipEntryName to ZipString

since the struct is now used for other purposes. Also add some
comparator functions to the struct to simplify zip_archive.cc.

This is a follow-up CL for f1d3d3b2477a813805b71099c60e07d36dbb225a.

Bug: 21957428
Change-Id: I60d4171eeacc561d59226d946e9eb5f9c96d80cf
/system/core/libziparchive/zip_archive_test.cc
f1d3d3b2477a813805b71099c60e07d36dbb225a 25-Jun-2015 Yusuke Sato <yusukes@google.com> Add |optional_suffix| to StartIteration()

so that PackageManagerService can iterate over files with a
specific file extension like ".so".

(cherry picked from commit a4a80693d9687982461decdcf86920b3e76bb41a)

Bug: 21957428
Change-Id: I36ba3c33a8b366a65f67cb6d156067c5caca1151
/system/core/libziparchive/zip_archive_test.cc
f899bd534b2dc51b9db8d27c76394b192fe51155 17-Apr-2015 Narayan Kamath <narayan@google.com> Avoid mapping output to memory while writing to a file.

It's unnecessary, and causes issues when the uncompressed
output is large.

Change-Id: I99cfb3933b094c2826c7e6c6de9aab03478fcc53
/system/core/libziparchive/zip_archive_test.cc
50afc159b3bba06cd02648b1e287ba06d4fac059 08-Sep-2014 Mykola Kondratenko <mykola.kondratenko@sonymobile.com> libziparchive: fix issue with a directory with one file

libziparchive fails to iterate some bootanimation archives
reporting invalid offset error. This is caused by failure
to process a directory with one file
(when name_offset + file_name_length == cd_offset).

Change-Id: I2733e7f782c14a6fadd5491bb94318ac968df206
/system/core/libziparchive/zip_archive_test.cc
40b52b2c884e2a0abf9c4af8b785433286b7e84b 16-Jul-2014 Dmitriy Ivanov <dimitry@google.com> Add close_file flag to OpenArchiveFd()

* We should be able to keep fd alive after CloseArchive()

Change-Id: I1aa2c039bb2a590ae72f256acc9ba5401c2c59b1
/system/core/libziparchive/zip_archive_test.cc
ecccc5ad9397264d3d05018647b4a2e39d7c774c 11-Aug-2014 Piotr Jastrzebski <haaawk@google.com> Replace char* with ZipEntryName in ziparchive API.

It's important because entry names can be encoded in UTF-8 and can have \0
character in the middle.
Use vector instead of char* for prefix in IterationHandle.

Bug: 16162465
Change-Id: Ie34c8d7c6231cc258530c22bdde5542895213649
/system/core/libziparchive/zip_archive_test.cc
b1a113f618561b274ab793e6401416d449c60449 25-Jul-2014 Neil Fuller <nfuller@google.com> Prevent the accidental closure of fd[0] for missing zip files.

Bug: 16530747
Change-Id: I3593f2bc4d56a2f91252ea795c90ce3c78e1ec06
/system/core/libziparchive/zip_archive_test.cc
926973ec1486dc7cd4692c7e339d744ea442699c 09-Jun-2014 Narayan Kamath <narayan@google.com> Replace hand written offsets with structures.

Given that all current & future android ABIs are
little endian, we can get rid of the explicit conversions
from memory regions to little endian data members.

Also cleans up a few C style casts that snuck in during
several -Werror efforts and fixes temporary file generation
on target.

bug: 15448202

Change-Id: I4fcbb3c1124cb82c82139d328344e54fc7895353
/system/core/libziparchive/zip_archive_test.cc
4f6b499ead3de87888d37a74adceaec92c584c0a 03-Jun-2014 Narayan Kamath <narayan@google.com> Reject zip files that have trailing bytes after their CD.

bug: 15287086
Change-Id: I03219c4c2ca6afc9d417a35bd98ae682f478fc25
/system/core/libziparchive/zip_archive_test.cc
cf86e2f85d98ed10cf5e0672e41631f6ea7e3e34 16-May-2014 Ying Wang <wangying@google.com> Fix host 64-bit build.

Bug: 13751317
Change-Id: Ib42d24408d053bacc24142ed18fc5f3181d2345b
/system/core/libziparchive/zip_archive_test.cc
48953a1b8fdcf1d6fa1aeeb40c57821d33fc87d2 24-Jan-2014 Narayan Kamath <narayan@google.com> Fix entry handling for 0 length entries.

Two minor issues were fixed:
- The offset to entry data can be the same as the
central directory offset when the last entry in the
file has length 0 and is stored (not deflated). Fix
a check that disallowed this. We already have a strict
check that entry data must end before the central directory,
so we're covered.
- We would attempt to map a segment of length 0 when writing
an entry whose length is 0. We should just return early in
this case.

bug: 12623277
Change-Id: I2a4ca0c4d170cc3cbf326e5ca13894acd9c434c9
/system/core/libziparchive/zip_archive_test.cc
00a258cec7bbecf10e04fef7ed4781cd750ba1d8 13-Dec-2013 Narayan Kamath <narayan@google.com> Fix ExtractEntryToFile.

We would always write uncompressed data at offset 0 instead
of the current filedescriptor offset.

Also adds a unit-test & a clarifying comment on the API.

Change-Id: If44757e96dde504ce63d81b4dec7115fc6f6d5fb
/system/core/libziparchive/zip_archive_test.cc
58aaf46e4d3c9f6ada086f88ecf137a9e04db2d9 10-Dec-2013 Narayan Kamath <narayan@google.com> Add unit tests for libziparchive.

- Add a build rule for host tests
- Add basic tests for Find / Iterate and Extract
for both deflated & stored entries.
- Fix an off by one error that the test uncovered.

Change-Id: If72009b1ea9791d5a265829f05c32ffe1c2752c4
/system/core/libziparchive/zip_archive_test.cc
7462f02f82cce1dd196069e6d84c5c3ea7bf10ff 21-Nov-2013 Narayan Kamath <narayan@google.com> Unify zipfile implementations : Step 1.

Extract zip file processing logic from libdvm into a
standalone library.

This library is a stricter than the libdvm library in
several ways:
- Duplicate zip entry names are now disallowed. Files with
such entries will fail to parse.
- We now verify CD file size information with the individual
file header information. (This was pointed out as a deficiency
of this implementation in past discussions.)
- We also add support for crc checking, which means we might
need to parse the optional data descriptor footer (if one
exists).

We also provide an API for iterating over the entries of
a zip file. This library is optimized for two use cases :

- Lookup for a single entry in the file, with the intention
of processing or extracting the data associated with that
entry
- Iterating over all entries in a file *and* processing
/ extracting their data.

Change-Id: Ia87de6184ef753cc470b0af755c47a4f92ac8198
/system/core/libziparchive/zip_archive_test.cc