Problem: Zipalign operates over several false assumptions. First it
assumes that zip entries are in the same order in the body and in
the Central Direcotry. Second, it assumes there are not space
between entries. This makes alignment incorrect when these asserts
are not true.
Solution: Don't align entries by tracking bias based on input zip
entry location. Calculate the expected alignment based on the out-
put zip file and correct with extra padding.
Fixes: 162117652
Test: Units Tests
Change-Id: Ia179338f658cab18a377cba2c7c8e629089a2785
Problem: Zipalign test invokes process but not verify.
Solution: Invoke both during test.
Test: Unit Test
Bug: NA
Change-Id: If603df301048f4b508e3429c4a8c77339ab351ae
As we support zip64 in libziparchive, we change the parameter of
the ReadAtOffset() in zip reader from uin32_t to off64_t. So the
derived class needs to be updated as well.
Bug: 150900468
Test: build
Change-Id: Icbfd2dd54b01ff62da988ba8598c1057f9bb6368
I really only care about code that's built for Windows, but I may as
well clean up anywhere that's easy to clean up too...
Bug: N/A
Test: builds
Change-Id: I3ef34fb12ac90e9411b6421e9c23dd8524f056ae
Use zip_archive directly. Note that this codepath is used only
when recompressing archives with zopfli during the alignment step.
It's unclear whether this is in use at all, but I verified that the
results are identical (note the usage of the "-z" flag in the test
below).
Test: make && out/host/linux-x86/bin/zipalign -v -f -z 8 \
out/target/product/marlin/system/app/Email/Email.apk ./out.zip
Bug: 35246701
Change-Id: I641cdb6d409cc07974d49d42c9f9e6d4f905e472
Warning from the static analyzer:
build/tools/zipalign/ZipFile.cpp:503:5: warning: Function call argument
is an uninitialized value
pEntry->setDataInfo(uncompressedLen, endPosn - startPosn, crc,
Specifically, it's referencing `crc`, which would be uninitialized if we
hit either of these two error cases, since we'd return `NO_ERROR`.
Note that the warning is still there, but that's only because the static
analyzer can't see the asserts. If we #undef NDEBUG in the file, then
the warning disappears.
Bug: none
Test: With NDEBUG undefined, the warning is gone.
Change-Id: Iaed66127746c38add2c842ab027f2e1982d0e2fd
This silences a warning null pointer passed as an argument to a
'nonnull' parameter
BUG=None
Test: The warning is gone.
Change-Id: I10a17d4674bfb373d7fe8666863abd5f10a4d11f
This updates the usage banner of zipalign to state that the -p switch
is supported in check alignment mode.
Change-Id: I119026b0e09e5a2528646e88a9b58dbb79c0c17c
Fix compilation warning:
" destination for this 'memcpy' call is a pointer to dynamic class
'CentralDirEntry'; vtable pointer will be overwritten"
by removing unnecessary virtual desctructor.
Bug: 27695718
Change-Id: Id3c451f82374f2232176115b7bc3291ac4275c00
getLongLE would return a 64-bit number with the upper 32-bits set when
decoding a 32-bit number with the top bit set. Per the zip file format,
it was only expected to return a 32-bit number. Use explicitly sized
types so that we use the proper sizes and don't do any implicit
extensions.
Change-Id: I5a4304dc99ce5f8f17284d4ca3094ae115207a1e
This reverts commit 3c2c064c87.
zipalign depends on libandroidfw, and some setups don't include frameworks/base.
Bug: 24201956
Change-Id: I48ee95808924f6b2221f0a49ab205c2565096b1f
Pass -X to zip so that Unix UID/GID and extra timestamps aren't
saved into the zip files.
Add a new option to zipalign, -t, to replace all timestamps with static
timestamps (2008 Jan 1 00:00:00). Use this for all non-APK zip files.
APK zip timestamps are set based on the certificate date in SignApk.
Bug: 24201956
Change-Id: Ifb619fc499ba9d99fc624f2acd5f8de36d78ef8e
Instead of wrapping a host module definition in 'ifeq($(HOST_OS),...)'
in the Android.mk files, define which hosts are supported using
LOCAL_MODULE_HOST_OS.
A blank LOCAL_MODULE_HOST_OS means that linux and darwin are supported.
A non-empty LOCAL_MODULE_HOST_OS lists the supported HOST_OSs.
Change-Id: I1e342d1908cfa00aef2c39c145b4f5f81c373bc6
So that we can support building both linux and windows binaries at the
same time on a linux host. This replaces the ifeq($(HOST_OS),...) checks
in Android.mk files.
Bug: 23566667
Change-Id: I693e11984e36d55bb6f09fa0d49bc485463e16fb
- Add a new flag to zipalign (-p) that page aligns shared
libraries (zip entries ending with ".so") in the archive.
- Add a new build variable LOCAL_PAGE_ALIGN_SHARED_LIBRARIES
to turn on this behaviour in zipalign.
- Add a new LOCAL_JNI_SHARED_LIBRARIES_ZIP_OPTIONS to control
zip behaviour.
Bug: 8076853
Bug: 19330157
Co-Authored-By: Simon Baldwin <simonb@google.com>
Co-Authored-By: Dimitry Ivanov <dimitry@google.com>
Change-Id: I1aa2c039bb2a590ae72f256acc9ba5401c2c59b1
Zopfli provides compression roughly 5% better than zlib, while remaining
completely compatible with zlib decoders. This patch adds a "-z" option
to zipalign, recompressing all compressed files within the zip archive.
Change-Id: If177ca4b82ec701b7446861b2cfe08c6bd403813
The problem is due to using variable inFileName instead of outFileName for printing out error message for output file.
Change-Id: Ie53a21b077fea5e7cd106fe6884cea159d2629a2
ZipUtils is needed by build/tools, move it from libandroidfw
(frameworks/base) to libutils (frameworks/native).
Change-Id: I188247d058f1baa0ebd14282208d496c4ba061be