History log of /system/core/libziparchive/zip_archive.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
b1911401e0008c2b12a3fe6c9dc34528bf7710a5 10-Mar-2016 Adam Lesinski <adamlesinski@google.com> libziparchive: ensure ReadAtOffset is atomic

ag/880725 modified ReadAtOffset to seek then read from the open
file descriptor. Previously pread64 was used to provide atomic
behaviour.

This causes races when multiple threads are trying to access data from
the file. This is supported, so this change reverts the relevant parts
of the above CL to restore the old behaviour.
Bug:27563413

Change-Id: I7bffd78da8c558745dfc3c072ba9691b1b15bb5b
/system/core/libziparchive/zip_archive.cc
b2a770042ebfd44989c2853689e5f45eee4a3ad9 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
(cherry picked from commit 8e6f7227641e05dccfc29dad62e29e730ff8f5ca)
/system/core/libziparchive/zip_archive.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.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.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.cc
ad4ad8cfc8c1eada8356d554eeb0639ee48ef00d 06-Oct-2015 Adam Lesinski <adamlesinski@google.com> Implement ZipWriter for quickly writing ZipFiles.

The ZipWriter implementation exposes a stateful interface that allows
bytes of data to be streamed in as they arrive. ZipEntries can be
compressed and/or aligned on a 32-bit boundary for mmapping at runtime.

Change-Id: I43ac9e661aa5022f00d9e12b247c4314d61c441c
/system/core/libziparchive/zip_archive.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.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.cc
e49236b3dae364532c07265d62abc9abd7ea6935 05-Jun-2015 Elliott Hughes <enh@google.com> Fix whitespace in debug logging.

Change-Id: I949317deaf782fea18b5c38b22dfd41811608276
/system/core/libziparchive/zip_archive.cc
a68d0d1fe48afc7a7a7fd0ee42df1607f21fa996 02-Jun-2015 Badhri Jagan Sridharan <Badhri@google.com> libziparchive: fix fallocate failures

The objective of fallocate call seems to be to
make sure that we have enough enough space left
in the disk to house the uncompressed file.
But, fallocate is only supported in the following
file systems:
btrfs, ext4, ocfs2, and xfs

Return error only when fallocate fails due to
lack of space. The immediate ftruncate call is
going to take of the majority of other errors.

Bug: 21561449
Change-Id: I7083f3c7e5d745bd6e8a190ac9020297d638d9d4
/system/core/libziparchive/zip_archive.cc
e97e66ea7c624190afa4639d6ddc60e7d013f46c 27-Apr-2015 Narayan Kamath <narayan@google.com> Use base::WriteFully in zip_archive.

We're already linking against libbase but we'll have to add
a libbase dependency to every target that includes libziparchive
as a STATIC_LIBRARY dependency, given that there's no way to
express that what we want (except by adding a LOCAL_WHOLE_STATIC_LIBRARY
dependency on libbase to libziparchive but that seems bad too)

Change-Id: I294ad389a9c61a1134a7bc323da25b0004a8f1e0
/system/core/libziparchive/zip_archive.cc
d6eac24aac0069cb6d00d2c723db5adab1a724c4 27-Apr-2015 Greg Hackmann <ghackmann@google.com> libziparchive: fix clang build

Change-Id: I69105a9cde05b182f65c7e574282bb4b48b66e95
Signed-off-by: Greg Hackmann <ghackmann@google.com>
/system/core/libziparchive/zip_archive.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.cc
e1d5a6aa5c4fc150c990bd160548aa8738bc51dc 15-Jan-2015 Ɓukasz Szymczyk <lukasz.szymczyk@sonymobile.com> Reserve space on disk using fallocate

There were crashes when android failed to extract
zip archives due to out of free space on disk, with stacks like:

#00 pc 00000000000156b0 /system/lib64/libc.so (memcpy+176)
#01 pc 000000000002e5b8 /system/lib64/libandroidfw.so
#02 pc 000000000002f488 /system/lib64/libandroidfw.so (ExtractToMemory+328)
#03 pc 000000000002f5c8 /system/lib64/libandroidfw.so (ExtractEntryToFile+268)
#04 pc 00000000000287d8 /system/lib64/libandroidfw.so (android::ZipFileRO::\
uncompressEntry(void*, int) const+12)

Space for the file is now allocated using fallocate rather than
ftruncate, since ftruncate dont actually reserve space on disk. When writes
to the mmaped pointer fails to be realized due to out of space SIGBUS
is the result. With this change we make sure that there is space available
before mmaping the pointer.

Change-Id: Ic5e8c33dbe729edb57919dacff73811b34cc2dc2
/system/core/libziparchive/zip_archive.cc
1ae0764e01ac0ad15cc16395fc36809343755823 09-Apr-2015 Dan Albert <danalbert@google.com> Prevent unaligned read in libziparchive.

Change-Id: I4afc3729a1b2c06a6621cb8c9742fc94b5a665f5
/system/core/libziparchive/zip_archive.cc
503cd6d4375d4f47c2cd5a83d3c8a651aeed521c 23-Mar-2015 Greg Hackmann <ghackmann@google.com> libziparchive: fix extraction of >2GiB images

Bug: 19888174

Change-Id: I33a577909ced522d46223e2182e0bb18c291af27
Signed-off-by: Greg Hackmann <ghackmann@google.com>
/system/core/libziparchive/zip_archive.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.cc
edbabfe9fe3c5939c3d9ae06b50c079f5e248ea3 12-Mar-2015 Dmitriy Ivanov <dimitry@google.com> Allocate buffers on the heap

Change-Id: I96c8a50e8987e8ea77d0766ccf3c619f60377864
/system/core/libziparchive/zip_archive.cc
1f741e51bc125e776e049c358bcde75069938980 06-Mar-2015 Dmitriy Ivanov <dimitry@google.com> Remove some more gotos

Change-Id: I9c4b3a5aecf4011653933b051e67605a6feb123f
/system/core/libziparchive/zip_archive.cc
f94e15900779904c1ac934e9c0679044c4974441 06-Mar-2015 Dmitriy Ivanov <dimitry@google.com> Reapply -Wold-style-cast

Added pragmas to disable checks for the method
using libz.h macros.

Change-Id: I25aa1adf09f3ecff61d8fea6306b24b37990ab46
/system/core/libziparchive/zip_archive.cc
3ea93da3c21c9f35d658f4760064a404fce3b43b 06-Mar-2015 Dmitriy Ivanov <dimitry@google.com> Remove some gotos

Change-Id: I0e162c8e0a700940f4302786b8523e5b2f5e5c27
/system/core/libziparchive/zip_archive.cc
f4cb8e2ac2020af33579988e7af53be23460a998 06-Mar-2015 Dmitriy Ivanov <dimitry@google.com> Cleanup old-style-cast warnings

Change-Id: I6e17fd993557cbf78ade787f112794358aee39c8
/system/core/libziparchive/zip_archive.cc
4b67f8339de629f2036eb717f8e014d2672ebfc8 06-Mar-2015 Dmitriy Ivanov <dimitry@google.com> Remove unnecessary allocation of FileMaps

Change-Id: I97bb72b9edeee5b3eff4ffd21a761a1af472a3b5
/system/core/libziparchive/zip_archive.cc
6832a7a4e04c84192f0bafc6ac990fc79cd13882 23-Feb-2015 Narayan Kamath <narayan@google.com> Remove useless refCounting from FileMap.

Nobody ever called acquire() so release() was always
equivalent to delete. Just use delete instead so that
people can use unique_ptr directly (or shared_ptr if
they really want refcounts).

Change-Id: I9e3ad5e0f6a4fcc4e02e5a2ff7ef9514fe234415
/system/core/libziparchive/zip_archive.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.cc
044bc8ee89462206dbf5f33c0573834ee507c955 03-Dec-2014 Narayan Kamath <narayan@google.com> Reject zip archives whose entry names are not valid UTF-8.

bug: 18584205
Change-Id: Iaf3e8211dab6a1e3923f7fee6ea7fc693972dba3
/system/core/libziparchive/zip_archive.cc
d0e6dc1ad1b4e6aeaba2af53012f0c84e32ccc08 24-Nov-2014 Andreas Gampe <agampe@google.com> Libziparchive: Remove unused variable

For build-system CFLAGS clean-up, remove unused variable.

Change-Id: Icc33cf5d0a5fe9a77c277b100de01b70164cc351
/system/core/libziparchive/zip_archive.cc
70160f4454f4b1a9371dd2a45d7b3e52e07e33d8 20-Nov-2014 Yabin Cui <yabinc@google.com> kill HAVE_PREAD

Bug: 18397613
Change-Id: I3990bd0f95cf38c5a9229180a1ddc699941892fc
/system/core/libziparchive/zip_archive.cc
8fd1f27ed866169684f44f24aeaa5c4722427d18 19-Aug-2014 Piotr Jastrzebski <haaawk@google.com> Merge "Reject zip archives with entry names containing \0."
78271ba97b5d867e3597b7fc2257dd1bbd513b05 15-Aug-2014 Piotr Jastrzebski <haaawk@google.com> Reject zip archives with entry names containing \0.

There should never be a need of an entry name with \0 character.

Bug: 16162465
Change-Id: Ia2ec57959280c1bb972c4d59d890c8540c5b9081
/system/core/libziparchive/zip_archive.cc
10aa9a0e2446092ccb1a0b53438fd775427160cc 19-Aug-2014 Piotr Jastrzebski <haaawk@google.com> Cleanup ziparchive

Addressed review comments from 8e08536108d2b5a7f4f9a4b008987b54602fda18

Change-Id: If576e2d6cc5ad330a7dee66b09663e0c04ea3801
/system/core/libziparchive/zip_archive.cc
8e08536108d2b5a7f4f9a4b008987b54602fda18 18-Aug-2014 Piotr Jastrzebski <haaawk@google.com> Fix win_sdk build by not using vector

Change-Id: I4e9ee4286ea29e1f5f2ee477525e79bfa16ad9a0
/system/core/libziparchive/zip_archive.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.cc
bd0a74854e71c79c15320bad607bdccd0b4bfedb 13-Aug-2014 Piotr Jastrzebski <haaawk@google.com> Revert "Make sure that names of all entries have the same encoding."

This reverts commit 6a7f4bb79dde575d30af562af916b572b80ff9c3.

Change-Id: Id4f5b601ff0b9d82ce2c9beeb9162eba9594b3a7
/system/core/libziparchive/zip_archive.cc
6a7f4bb79dde575d30af562af916b572b80ff9c3 12-Aug-2014 Piotr Jastrzebski <haaawk@google.com> Make sure that names of all entries have the same encoding.

Add new public method to allow checkisc if an archive has entry names encoded in
UTF-8. If not then they will be encoded in IBM PC character encoding.

Bug: 16162465
Change-Id: I4468d76accca8a9b0b31cae8d43399ffc22cad42
/system/core/libziparchive/zip_archive.cc
34e03bdfdf3defc667eab68f126ad3370547159a 08-Aug-2014 Piotr Jastrzebski <haaawk@google.com> Make a copy of a prefix param in StartIteration

and delete it in EndIteration.

Change-Id: I4de4167700a9dba3119fde22fcd45725742f3731
/system/core/libziparchive/zip_archive.cc
79c8b34f36ef29d481e76ebd8af97992c894d58c 08-Aug-2014 Piotr Jastrzebski <haaawk@google.com> Add EndIteration method to free memory allocated

in StartIteration. This method should always be called when the
iteration is over to make sure that we don't leak memory.

Change-Id: I5205c754dfafbab9bb5f06003c3663d2ec4e8a35
/system/core/libziparchive/zip_archive.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.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.cc
c00de56063deaa3c27ab0f1778730e3f14e9a952 06-Jun-2014 Narayan Kamath <narayan@google.com> Fix build.

Uncommitted changes from a rename.

Change-Id: If1cac7104c436970f905eede683040ae79529292
/system/core/libziparchive/zip_archive.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.cc
96c5c99bda0d6fec3acb32bc1aea10ebe81be017 09-May-2014 Mark Salyzyn <salyzyn@google.com> libziparchive: off64_t is not int64_t (part deux)

Change-Id: I38e78bdba338a0c40aec43d6c86f26f388cee6ab
/system/core/libziparchive/zip_archive.cc
56a90a08dbbbf96ef415dc6bc84bff2a409efc68 09-May-2014 Mark Salyzyn <salyzyn@google.com> libziparchive: off64_t is not int64_t

- ToDo: investigate why our system headers let us down.

Change-Id: Iada422adbbbd4fbd0fc09b51b97b3cd06ccc6374
/system/core/libziparchive/zip_archive.cc
088bf90e5de251f4b2f2419187d8ee5d7b2bd831 09-May-2014 Mark Salyzyn <salyzyn@google.com> libziparchive: 64 bit issues

Change-Id: I1b53aff5b1527a3623d17deed306624707d345ef
/system/core/libziparchive/zip_archive.cc
51d562d39976451a3a29992b00f36ea54e06c4af 05-May-2014 Mark Salyzyn <salyzyn@google.com> libziparchive: Turn on -Werror

Change-Id: I98a93273b9e1bac0324dd210f6a8493ba780e878
/system/core/libziparchive/zip_archive.cc
99ef9914be1e39276e2e077670368927a1221921 14-Mar-2014 Mark Salyzyn <salyzyn@google.com> libziparchive: 64 bit compile issues

- All within LOG messages.

Change-Id: I52e81b49e8127276359c62febd4cc1d8d69102d9
/system/core/libziparchive/zip_archive.cc
5f98b12640af0fd937c1cd5929248f8f01779922 05-Mar-2014 Mathieu Chartier <mathieuc@google.com> Add free to CloseArchive.

Currently CloseArchive doesn't call free and call sites don't appear
to either. I could not find any call sites which manually freed the
archive by deleting the handle. This fixes several memory leaks.

Change-Id: I21f187dde60fd87e6e54bde06de9e76fd0791104
/system/core/libziparchive/zip_archive.cc
f4b0b7971c0333b7331c2f54384af5de0260ae75 07-Feb-2014 Colin Cross <ccross@android.com> Fix logging errors inside ALOGV

Fix errors exposed by adding checking to disabled ALOGVs.

Change-Id: I36b77bb0ad8dc7661b0f834f20d1179b86134d57
/system/core/libziparchive/zip_archive.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.cc
a1ff801e5f8f896d7961f1b015c75b824e9c44a4 31-Dec-2013 Narayan Kamath <narayan@google.com> Change a debug log to a verbose log.

Unlike ALOGV, messages from ALOGD are logged on
all configurations. Not finding an entry in a zip
file is a "normal" occurrence so using an ALOGD
message for it amounts to spam.

Change-Id: I2c60d11e8a750be5106afd65c3c5e335f53f01b6
/system/core/libziparchive/zip_archive.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.cc
7d92b7cc6580285ab7f8ef86be7512eafda89354 12-Dec-2013 Narayan Kamath <narayan@google.com> Merge "Get rid of some log spam."
f6a196522ac823bef7eb06267e3c00ccdef1d298 12-Dec-2013 Narayan Kamath <narayan@google.com> Get rid of some log spam.

We don't need a warning if an entry isn't found in a zip
file. It can happen as part of normal operation.

Change-Id: I86c132a040371f36f0dd981b49c02b3173821439
/system/core/libziparchive/zip_archive.cc
eaf988532b9e603b1599b7750bfa923fbb39d297 11-Dec-2013 Narayan Kamath <narayan@google.com> Use FileMap from libcutil instead of rolling our own.

Adds windows support as a side effect.

Change-Id: I912c1f980f284d01d4f3936291999646ddf6250a
/system/core/libziparchive/zip_archive.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.cc
eb41ad212e125aa81f09df850e0c41e11ba96043 09-Dec-2013 Narayan Kamath <narayan@google.com> Fix return code for ended iteration.

The API promises a return code of -1 for an
ended iteration and lower negative values for
errors.

Change-Id: I688a1ee2efad1bdfc6959cf27e49c0426ebf27f8
/system/core/libziparchive/zip_archive.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.cc