Before this change, entry times before 1980 had the year changed to 1980
but the month/day/hour/minutes/seconds were all kept as-is.
Bug: 277978832
Test: atest zipalign_tests
Change-Id: I9f87e98a6b985002578490b87c654fee86c65d62
Allow apps to specify the target page size for aligning their
uncompressed shared libraries.
This allows apps that want to support larger page sizes to do
so by specifiying the -P <pagesize_kb> flag.
However, apps built for 4k-only devices are unaffected as they
can continue to use -p flag for 4kB page alignment of uncompressed
shared libraries.
Bug: 276963821
Test: atest -c zipalign_tests
Change-Id: I890db067b8f898045f73e86788662f94a48af772
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
zipalign_test is passing (int)4096 instead of required bool
for the pageAlignSharedLibs parameter. Update the test to use
the correct type.
Bug: 276963821
Test: atest -c zipalign_tests
Change-Id: I4150dbd411e5a40427281645aa03262f7b0c9e3a
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Even if we were shipping 64-bit Windows host tools (which we still
aren't), this would still be a bug. Windows is LLP64 instead of LP64,
so the long that ftell()/fseek() uses isn't big enough for a 64-bit off_t.
Test: treehugger
Change-Id: I4e24afe811ff9b7d5696887cc5ee92e54e4a3b76
Directories are entries with uncompressed size zero and ending with
character '/' or '\' are allowed in apks since b/204425803. These
entries should not be considered for alignment since they are not
mmap by the framework.
Test: align_test.cpp
Bug: 250872480
Change-Id: I964aad118a82839f9ed230acc4c2c76f51888c67
Avoid writing test files in the build output directory which fails when
run with Bazel. This happens because Bazel's sandboxing environment
ensures that the test's working directory is unwritable.
See https://docs.bazel.build/versions/main/sandboxing.html for more
information.
Bug: 209687942
Test: atest --bazel-mode zipalign_tests
Test: atest zipalign_tests
Change-Id: Ie22f464830c1ffe4d38a94a16dbd39dafa7fe317
b/177069043 is a flake that happens in zipalign during I/O, but
the error doesn't contain enough information to determine what the
problem is. Add more logging on I/O errors.
Test: atest --host zipalign_tests
Bug: 177069043
Change-Id: I89573e5b3867abe05d855c837bb2aa5b5c630aa7
Not needed as the host-unit-tests suite runs in
presbumit now and cover this
Test: None
Bug: 175408655
Change-Id: Iea3e3cd7f696f43b6c686ef9cbee1194f514e589
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