Commit graph

162 commits

Author SHA1 Message Date
Christian Poetzsch
3081c5ebfb libziparchive: use _FILE_OFFSET_BITS=64
On 32 bit system those calls may fail if one tries to unpack files which
are bigger than 2GB.

Use large file system support to fix this problem.

Test: unpack a file bigger than 2GB on 32 bit Android systems

Change-Id: Ibd9bd5fc4a2f8dc7df98bd595f4fd1638a4f0d4a
Signed-off-by: Christian Poetzsch <christian.potzsch@imgtec.com>
2016-12-21 12:05:10 +00:00
Dan Willemsen
69b0123549 Enable libbase/libutils/libziparchive on host bionic
am: ab34b47b35

Change-Id: If8e762eace58a494efede9ef5cb09be99b74e5b8
2016-11-30 06:05:59 +00:00
Dan Willemsen
ab34b47b35 Enable libbase/libutils/libziparchive on host bionic
Bug: 31559095
Test: Test linux_bionic compile
Change-Id: Ib42c063532c1cbeb3e1418ab16a1fb54d5902aab
2016-11-29 13:38:53 -08:00
Tao Bao
af2a8858c4 Merge "ziparchive: Allow ExtractEntryToFile() to work with block device."
am: 787482ecd9

Change-Id: Icdce4207cb64e084e200b6f7f8ae194831d5c4f0
2016-11-15 22:11:21 +00:00
Tao Bao
a456c21348 ziparchive: Allow ExtractEntryToFile() to work with block device.
FileWriter::Create() calls ftruncate(2) to truncate the destination
file, which doesn't work with FD that references a block device. It
leads to kIoError when calling ExtractEntryToFile() to extract an entry
to block device FD.

As a result, it fails the package_extract_file() command in OTA updates
(e.g. 'package_extract_file("boot.img",
"/dev/block/platform/soc.0/f9824900.sdhci/by-name/boot")').

This CL skips the call to ftruncate(2) if FD references a block device.

Bug: 32903624
Test: ziparchive-tests works.
Test: Build an OTA updater (m updater) and call package_extract_file().

Change-Id: Ia81116f1a8d7cab802396bdc32c6096b4cb56a3c
2016-11-15 10:19:04 -08:00
Mark Salyzyn
8a7297a09f Merge "system/core: preparation to pull back interfaces from android/log.h"
am: 27d2d49f48

Change-Id: I604bb1d4cf62636663fa92e3d14a55887dbcae23
2016-10-20 18:03:57 +00:00
Mark Salyzyn
cfd5b080af system/core: preparation to pull back interfaces from android/log.h
Point to log/log.h where necessary, define LOG_TAG where necessary.
Accept that private/android_logger.h is suitable replacement for
log/logger.h and android/log.h.

Correct liblog/README

Effectively a cleanup and controlled select revert of
'system/core: drop or replace log/logger.h' and
'system/core: Replace log/log.h with android/log.h'.

Test: compile
Bug: 30465923
Change-Id: Ic2ad157bad6f5efe2c6af293a73bb753300b17a2
2016-10-20 08:11:39 -07:00
Tianjie Xu
b2ca85184b Merge "Add functions in recovery/minzip to libziparchive"
am: 4bc51d1ea4

Change-Id: Ica94e8050286bed1c5bc23a33305050ab8da8ec5
2016-10-18 21:57:30 +00:00
Tianjie Xu
18c25920c2 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
2016-10-15 23:16:34 -07:00
Tianjie Xu
206150bf78 Fix out of bound access in libziparchive am: 1ee4892e66 am: c24dd97654 am: 8788591224 am: 167562aa76 am: 398adf9b55 am: 680c3f1dc4 am: f0ce69815f
am: 6fb68bb196

Change-Id: Id8f75debfae94d35dbbee9799632cba3f72648d0
2016-10-07 00:30:02 +00:00
Tianjie Xu
6fb68bb196 Fix out of bound access in libziparchive am: 1ee4892e66 am: c24dd97654 am: 8788591224 am: 167562aa76 am: 398adf9b55 am: 680c3f1dc4
am: f0ce69815f

Change-Id: I8e69df083b6d5cd3a7e6bf7113ae836932c2e9f2
2016-10-07 00:26:31 +00:00
Tianjie Xu
167562aa76 Fix out of bound access in libziparchive am: 1ee4892e66 am: c24dd97654
am: 8788591224

Change-Id: I2f0ca98c74f23b1125f29b1eaf810143a83754b4
2016-10-07 00:11:29 +00:00
Mark Salyzyn
ff2dcd9af9 system/core Replace log/log.h with android/log.h
Should use android/log.h instead of log/log.h as a good example
to all others.  Adjust header order to comply with Android Coding
standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I33a8fb4e754d2dc4754d335660c450e0a67190fc
2016-09-30 12:47:05 -07:00
Tianjie Xu
1ee4892e66 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.

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

Bug: 31251826
Change-Id: I1d8092a19b73886a671bc9d291cfc27d65e3d236
(cherry picked from commit ae8180c06d)
2016-09-22 18:24:53 -07:00
Colin Cross
7c6c7f0b9f Fix warnings in libziparchive
system/core/include is included in the global include path using
-isystem, which hides all warnings.  zlib.h is included through
system/core/include/ziparchive/zip_archive.h, which was hiding warnings
in it.  Use a #pragma around the call to deflateInit2, it is a macro
that expands to an old-style cast, in preparation for moving from
-isystem to -I.  Also move the ZipString constructor to zip_archive.cc
so it can assert on the length of the string parameter and fix an
implicit conversion from size_t to uint16_t.

Test: m -j native
Bug: 31492149
Change-Id: I74cdad7fe9c723859b5cfbea73c8f27d9d9ca265
2016-09-20 09:23:47 -07:00
Narayan Kamath
388a65d146 Merge "zip_archive: Improve error message on fallocate failure."
am: 704d818ec1

Change-Id: Ic1ab5e824dcc2b6a78e8ceb29732185ad5da1987
2016-08-16 09:03:04 +00:00
Narayan Kamath
d5d7abe3d1 zip_archive: Improve error message on fallocate failure.
Noticed on b/30765660.

Change-Id: I1a98f83fef02a7368bdc2e1f8f24a0771eebe468
2016-08-10 12:24:05 +01:00
Colin Cross
2fedbf79bb resolve merge conflicts of 41e82a3 to stage-aosp-master
Change-Id: I5a7faca3249f0c038914540b1dd29edf0084c0e1
2016-07-12 23:53:04 -07:00
Colin Cross
45566ba879 Convert libziparchive from Android.mk to Android.bp
Change-Id: I6f0df9046b848ee8b841ae0a608a6adc981788e7
2016-07-12 21:01:08 -07:00
Chih-hung Hsieh
63eca85308 Merge "Fix google-explicit-constructor warnings." am: e1d5c25
am: e641a2f

* commit 'e641a2fa619c29dc25c329520ea300c21f908dcc':
  Fix google-explicit-constructor warnings.

Change-Id: I461fe586fd8d23fa5abbe94859e609c29fbe889a
2016-04-26 00:49:15 +00:00
Chih-Hung Hsieh
3a114e0a81 Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I5d1988efc1563efbdb25c867713c54f41439a82a
2016-04-25 14:57:11 -07:00
Adam Lesinski
b1911401e0 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
2016-03-09 17:17:19 -08:00
Yabin Cui
b2a770042e 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 8e6f722764)
2016-03-07 11:21:24 -08:00
Yabin Cui
8e6f722764 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
2016-02-08 16:52:55 -08:00
Christopher Ferris
5e9f3d44a3 Allow setting an arbitrary alignment for an entry.
The current code only allows the creation of an entry that is 32 bit
aligned.

Bug: 25446938

Change-Id: I6c924df12ef2bc067b3de7789257af7e3db7e904
2016-01-19 13:55:53 -08:00
Christopher Ferris
e6884ce56f 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
2016-01-14 12:30:20 -08:00
Elliott Hughes
4f71319df0 Track rename of base/ to android-base/.
Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
2015-12-04 22:00:26 -08:00
Christopher Ferris
a2a32b0ec6 Fix bug in writing zips.
The code does not handle an edge case where writing a compressed
image can overflow the avail_out data when doing a flush. Add a
loop to keep writing the data while deflate indicates that it doesn't
have enough space to write out the compressed data during the flush.

Change-Id: I1f1d1646457ed9b67ed24f6582688c300186c23c
2015-11-05 10:48:05 -08:00
Adam Lesinski
25322eeddd Merge "ZipWriter: archive disk numbers are 0 index based" 2015-10-30 16:56:11 +00:00
Adam Lesinski
ac60abdd70 Merge "Add deflate compression to ZipWriter" 2015-10-30 16:55:55 +00:00
beonit
0e99a2f79a 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
2015-10-30 10:01:38 +00:00
Adam Lesinski
044c790b85 ZipWriter: archive disk numbers are 0 index based
Misunderstood that disk numbers were 1 index based.

Change-Id: I0c1f43436f1c5e9394818ad12164f6d7b982cbd8
2015-10-20 12:41:49 -07:00
Adam Lesinski
591fd3953d Add deflate compression to ZipWriter
Use zlib to deflate compress data into the zip file.

Change-Id: If094b926a67e199be976c3190781cd0101dd66e1
2015-10-20 12:40:33 -07:00
Adam Lesinski
ad4ad8cfc8 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
2015-10-15 16:27:44 -07:00
Dan Willemsen
87a419c8b1 Remove USE_MINGW/CYGWIN; Whitelist windows modules
CYGWIN is not supported, USE_MINGW and HOST_OS==windows are being
replaced with LOCAL_..._windows variables.

Bug: 23566667
Change-Id: I3e4a1e4097dc994cf5abdce6939e83a91758fd75
2015-09-02 17:10:35 -07:00
Evgenii Stepanov
953314fc21 Fix ODR issues in ART.
Linking against both libziparchive-host and libz-host results in
libz loaded twice (because it is also linked statically in
libziparchive).

Change-Id: Ib34eef60200a702c2d7fbca3589b324992e78eab
2015-06-29 16:27:44 -07:00
Yusuke Sato
07447544ad 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 f1d3d3b247.

Bug: 21957428
Change-Id: I60d4171eeacc561d59226d946e9eb5f9c96d80cf
2015-06-26 10:34:01 -07:00
Yusuke Sato
f1d3d3b247 Add |optional_suffix| to StartIteration()
so that PackageManagerService can iterate over files with a
specific file extension like ".so".

(cherry picked from commit a4a80693d9)

Bug: 21957428
Change-Id: I36ba3c33a8b366a65f67cb6d156067c5caca1151
2015-06-25 14:10:05 -07:00
Yusuke Sato
a4a80693d9 Add |optional_suffix| to StartIteration()
so that PackageManagerService can iterate over files with a
specific file extension like ".so".

Bug: 21957428
Change-Id: I76ed9560d4d1e00d297a97d518ec357166be1981
2015-06-23 17:31:16 -07:00
Elliott Hughes
e49236b3da Fix whitespace in debug logging.
Change-Id: I949317deaf782fea18b5c38b22dfd41811608276
2015-06-04 15:21:59 -07:00
Badhri Jagan Sridharan
71aebefe49 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: http://b/21558406
Bug: 21561449
Change-Id: I7083f3c7e5d745bd6e8a190ac9020297d638d9d4
(cherry picked from commit a68d0d1fe4)
2015-06-04 13:26:29 -07:00
Narayan Kamath
67ab5d9505 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)

Bug: http://b/21558406
Change-Id: I294ad389a9c61a1134a7bc323da25b0004a8f1e0
(cherry picked from commit e97e66ea7c)
2015-06-04 13:26:22 -07:00
Greg Hackmann
4ba18cf3ff libziparchive: fix clang build
Bug: http://b/21558406
Change-Id: I69105a9cde05b182f65c7e574282bb4b48b66e95
Signed-off-by: Greg Hackmann <ghackmann@google.com>
(cherry picked from commit d6eac24aac)
2015-06-04 13:26:12 -07:00
Narayan Kamath
785a128aec Avoid mapping output to memory while writing to a file.
It's unnecessary, and causes issues when the uncompressed
output is large.

Bug: http://b/21558406
Change-Id: I99cfb3933b094c2826c7e6c6de9aab03478fcc53
(cherry picked from commit f899bd534b)
2015-06-04 13:25:52 -07:00
Badhri Jagan Sridharan
a68d0d1fe4 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
2015-06-03 11:02:26 -07:00
Evgeniy Stepanov
a8cc2081b4 Revert "Fix ODR issues in ART."
Fails build on Mac.

This reverts commit 2148a1243e.

Change-Id: Ib4f0ba0b0a42500f20b7d73ca91363477fe3d093
2015-05-30 00:47:30 +00:00
Evgenii Stepanov
2148a1243e Fix ODR issues in ART.
Linking against both libziparchive-host and libz-host results in
libz loaded twice (because it is also linked statically in
libziparchive).

bug: 21365909

Change-Id: Ie924e0b38e4c0811daff06e7c0bfed048e7ca82f
2015-05-28 10:53:23 -07:00
Narayan Kamath
e97e66ea7c 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
2015-04-29 14:31:45 +00:00
Greg Hackmann
d6eac24aac libziparchive: fix clang build
Change-Id: I69105a9cde05b182f65c7e574282bb4b48b66e95
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2015-04-27 10:14:32 -07:00
Narayan Kamath
f899bd534b 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
2015-04-27 13:34:18 +01:00
Łukasz Szymczyk
e1d5a6aa5c 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
2015-04-20 09:49:26 +00:00
Dan Albert
1ae0764e01 Prevent unaligned read in libziparchive.
Change-Id: I4afc3729a1b2c06a6621cb8c9742fc94b5a665f5
2015-04-09 17:00:14 -07:00
Elliott Hughes
bcc2b5f44a Remove LOCAL_ADDITIONAL_DEPENDENCIES in cases where it's not needed.
Change-Id: I720b8ef1050da45a7833adef8219b6acb2cf3a38
2015-04-02 14:31:07 -07:00
Greg Hackmann
503cd6d437 libziparchive: fix extraction of >2GiB images
Bug: 19888174

Change-Id: I33a577909ced522d46223e2182e0bb18c291af27
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2015-03-23 14:30:40 -07:00
Mykola Kondratenko
50afc159b3 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
2015-03-19 09:28:41 +00:00
Dmitriy Ivanov
edbabfe9fe Allocate buffers on the heap
Change-Id: I96c8a50e8987e8ea77d0766ccf3c619f60377864
2015-03-12 14:47:52 -07:00
Dmitriy Ivanov
1f741e51bc Remove some more gotos
Change-Id: I9c4b3a5aecf4011653933b051e67605a6feb123f
2015-03-06 14:26:37 -08:00
Dmitriy Ivanov
f94e159007 Reapply -Wold-style-cast
Added pragmas to disable checks for the method
 using libz.h macros.

Change-Id: I25aa1adf09f3ecff61d8fea6306b24b37990ab46
2015-03-06 13:57:43 -08:00
Dmitriy Ivanov
34d1b0fa63 Fix build: Remove -Wold-style-cast
libz.h has macros using old-style-cast.

Change-Id: I48f7d85805c7c34e1453c863da3c9e734a57d479
2015-03-06 13:07:52 -08:00
Dmitriy Ivanov
3ea93da3c2 Remove some gotos
Change-Id: I0e162c8e0a700940f4302786b8523e5b2f5e5c27
2015-03-06 12:45:03 -08:00
Dmitriy Ivanov
f4cb8e2ac2 Cleanup old-style-cast warnings
Change-Id: I6e17fd993557cbf78ade787f112794358aee39c8
2015-03-06 10:50:56 -08:00
Dmitriy Ivanov
4b67f8339d Remove unnecessary allocation of FileMaps
Change-Id: I97bb72b9edeee5b3eff4ffd21a761a1af472a3b5
2015-03-06 10:22:34 -08:00
Narayan Kamath
6832a7a4e0 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
2015-02-23 15:49:43 +00:00
Dmitriy Ivanov
40b52b2c88 Add close_file flag to OpenArchiveFd()
* We should be able to keep fd alive after CloseArchive()

Change-Id: I1aa2c039bb2a590ae72f256acc9ba5401c2c59b1
2015-01-30 17:57:13 -08:00
Narayan Kamath
3f5bba537e Merge "Reject zip archives whose entry names are not valid UTF-8." 2014-12-08 13:08:34 +00:00
Narayan Kamath
044bc8ee89 Reject zip archives whose entry names are not valid UTF-8.
bug: 18584205
Change-Id: Iaf3e8211dab6a1e3923f7fee6ea7fc693972dba3
2014-12-08 12:25:05 +00:00
Trevor Drake
f73237346e Clean up libziparchive Android.mk
Removed LOCAL_C_INCLUDES which are no longer necessary as zlib
now uses the LOCAL_EXPORT_C_INCLUDE_DIRS mechanism.

Removed a couple of redundant LOCAL_MODULE entries

Tested compiling some of the projects that make use of libziparchive
and libziparchive-host using a clean out dir with aosp_flounder-userdebug
aosp_arm-eng targets

make -j3 libziparchive libandroidfw libartd libart libjavacore libjavacoretests aapt

Change-Id: I2988f1b3a62d1df2b5eada4ad39a9246ac1184fb
2014-12-06 00:07:05 +00:00
Andreas Gampe
d0e6dc1ad1 Libziparchive: Remove unused variable
For build-system CFLAGS clean-up, remove unused variable.

Change-Id: Icc33cf5d0a5fe9a77c277b100de01b70164cc351
2014-11-24 10:09:06 -08:00
Yabin Cui
70160f4454 kill HAVE_PREAD
Bug: 18397613
Change-Id: I3990bd0f95cf38c5a9229180a1ddc699941892fc
2014-11-19 20:47:18 -08:00
Dan Albert
5fc8f683e6 am 7a92d20e: Merge "Clean up some test makefiles."
* commit '7a92d20ec845c07472eaea7cf14fd0e69df836ef':
  Clean up some test makefiles.
2014-11-05 02:27:42 +00:00
Dan Albert
27d166cb3a Clean up some test makefiles.
Needed for building with libc++ as the default STL.

Bug: 15193147
Change-Id: I8b462bd288fbea7e0ab182f85ffcbf438afb6aa4
2014-11-04 17:19:55 -08:00
Ian Rogers
8dac3559dd am b968d5c8: Merge "Add shared library version of libziparchive."
* commit 'b968d5c8468c9b0707f88f773fae16074e9018cf':
  Add shared library version of libziparchive.
2014-10-30 18:08:17 +00:00
Ian Rogers
40ac96c72c Add shared library version of libziparchive.
Change-Id: I9abded3bbff0e7976b1849c73e6978dd10ca84cd
2014-10-30 09:53:38 -07:00
Xavier Ducrohet
0c7ad123ca am cd1da4e0: Fix toolchain issue for windows build of libziparchive.
* commit 'cd1da4e04f0eb71a92a586c66acd0e34115608e1':
  Fix toolchain issue for windows build of libziparchive.
2014-10-16 16:55:08 +00:00
Xavier Ducrohet
cd1da4e04f Fix toolchain issue for windows build of libziparchive.
With mingw 4.8, the new default packed behavior is broken and makes
zip archive fails due to unexpected misalignment in
CentralDirectoryRecord.

This patch uses -mno-ms-bitfields to revert to the old packed
behavior.

Change-Id: Ic977c841e330e19451db1d31ddb22e570a525062
2014-10-16 07:49:16 +00:00
Piotr Jastrzebski
0c1b894b69 Reject zip archives with entry names containing \0.
There should never be a need of an entry name with \0 character.

Bug: 16162465

(cherry picked from commit 78271ba97b)

Change-Id: I68c72fb45e8ec70eb125cfc887488bc18ba5447d
2014-08-26 13:48:44 +01:00
Piotr Jastrzebski
8fd1f27ed8 Merge "Reject zip archives with entry names containing \0." 2014-08-16 05:59:09 +00:00
Piotr Jastrzebski
78271ba97b 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
2014-08-19 11:02:58 +01:00
Piotr Jastrzebski
10aa9a0e24 Cleanup ziparchive
Addressed review comments from 8e08536108

Change-Id: If576e2d6cc5ad330a7dee66b09663e0c04ea3801
2014-08-19 10:58:03 +01:00
Piotr Jastrzebski
8e08536108 Fix win_sdk build by not using vector
Change-Id: I4e9ee4286ea29e1f5f2ee477525e79bfa16ad9a0
2014-08-18 14:04:56 +01:00
Piotr Jastrzebski
ecccc5ad93 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
2014-08-15 12:39:45 +01:00
Piotr Jastrzebski
bd0a74854e Revert "Make sure that names of all entries have the same encoding."
This reverts commit 6a7f4bb79d.

Change-Id: Id4f5b601ff0b9d82ce2c9beeb9162eba9594b3a7
2014-08-13 09:49:25 +00:00
Piotr Jastrzebski
6a7f4bb79d 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
2014-08-13 09:58:16 +01:00
Piotr Jastrzebski
34e03bdfdf Make a copy of a prefix param in StartIteration
and delete it in EndIteration.

Change-Id: I4de4167700a9dba3119fde22fcd45725742f3731
2014-08-11 14:20:24 +01:00
Piotr Jastrzebski
79c8b34f36 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
2014-08-11 07:58:00 +01:00
Neil Fuller
0047368d7d Prevent the accidental closure of fd[0] for missing zip files.
(cherry picked from commit b1a113f618)
Bug: 16530747

Change-Id: I0d1be3dcadfa5128ffe04cec60f6c998dff61991
2014-07-28 08:41:26 +00:00
Neil Fuller
e91d9d80d1 Merge "Prevent the accidental closure of fd[0] for missing zip files." 2014-07-23 19:33:25 +00:00
Neil Fuller
b1a113f618 Prevent the accidental closure of fd[0] for missing zip files.
Bug: 16530747
Change-Id: I3593f2bc4d56a2f91252ea795c90ce3c78e1ec06
2014-07-25 16:06:20 +01:00
Tim Murray
06fce9db05 Update makefiles for host clang.
bug 16172793

Change-Id: If7484c5dbcccce7d925bec97bff0a3e4c30e9434
2014-07-24 12:18:22 -07:00
Ian Rogers
5af80aa119 Enable host multilib for ART testing.
Change-Id: Ic3ae5122eba13565fb5a4cb1bd0e7e465fb2140c
2014-06-17 01:50:25 -07:00
Narayan Kamath
926973ec14 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
2014-06-10 10:36:34 +01:00
Narayan Kamath
c00de56063 Fix build.
Uncommitted changes from a rename.

Change-Id: If1cac7104c436970f905eede683040ae79529292
2014-06-06 10:20:37 +00:00
Narayan Kamath
4f6b499ead Reject zip files that have trailing bytes after their CD.
bug: 15287086
Change-Id: I03219c4c2ca6afc9d417a35bd98ae682f478fc25
2014-06-05 18:37:08 +01:00
Ying Wang
cf86e2f85d Fix host 64-bit build.
Bug: 13751317
Change-Id: Ib42d24408d053bacc24142ed18fc5f3181d2345b
2014-05-16 09:36:17 -07:00
Mark Salyzyn
96c5c99bda libziparchive: off64_t is not int64_t (part deux)
Change-Id: I38e78bdba338a0c40aec43d6c86f26f388cee6ab
2014-05-08 19:16:40 -07:00
Mark Salyzyn
56a90a08db libziparchive: off64_t is not int64_t
- ToDo: investigate why our system headers let us down.

Change-Id: Iada422adbbbd4fbd0fc09b51b97b3cd06ccc6374
2014-05-08 17:20:55 -07:00
Mark Salyzyn
088bf90e5d libziparchive: 64 bit issues
Change-Id: I1b53aff5b1527a3623d17deed306624707d345ef
2014-05-08 16:06:54 -07:00
Mark Salyzyn
51d562d399 libziparchive: Turn on -Werror
Change-Id: I98a93273b9e1bac0324dd210f6a8493ba780e878
2014-05-07 16:56:21 -07:00
Mark Salyzyn
99ef9914be libziparchive: 64 bit compile issues
- All within LOG messages.

Change-Id: I52e81b49e8127276359c62febd4cc1d8d69102d9
2014-03-14 14:47:15 -07:00
Mathieu Chartier
5f98b12640 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
2014-03-04 17:44:58 -08:00