Commit graph

9 commits

Author SHA1 Message Date
Fabien Sanglard
a720635be2 Fix zipalign alignment error
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
2020-11-11 17:00:22 -08:00
Chih-Hung Hsieh
0c0d92887c Fix or suppress some google-runtime-int warnings.
Bug: 112478838
Test: build with WITH_TIDY=1
Change-Id: Ie3b15a85770b5806cddfd49a475aaf0553f9ec78
2018-08-10 15:14:26 -07:00
Narayan Kamath
b46507ff9e zipalign: remove support for adding members from gzip sources.
This was vestigial code and never actually called anywhere.

Test: make
Bug: 35246701
Change-Id: I9297ac5fa030d369946857414155450635b65410
2017-02-16 10:53:09 +00:00
Dan Willemsen
41bc424c32 Use explicitly sized types in zipalign/ziptime
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
2015-11-04 23:52:52 +00:00
Dan Willemsen
b589ae4e26 Revert "Remove changing uids/timestamps from zip/jar files"
This reverts commit 3c2c064c87.

zipalign depends on libandroidfw, and some setups don't include frameworks/base.

Bug: 24201956
Change-Id: I48ee95808924f6b2221f0a49ab205c2565096b1f
2015-10-29 21:26:18 +00:00
Dan Willemsen
3c2c064c87 Remove changing uids/timestamps from zip/jar files
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
2015-10-29 11:57:16 -07:00
Raph Levien
093d04c631 Add Zopfli-recompress option to zipalign
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
2014-07-07 16:03:49 -07:00
Glenn Kasten
1022e27642 Fix build warning
Change-Id: I1e3a76e4bdae5eec4f75c5d8eb9f533afab6d140
2012-01-12 07:30:27 -08:00
Mathias Agopian
3344b2e9b2 break dependency on utils/ZipEntry.h and utils/ZipFile.h 2009-06-05 14:55:48 -07:00