summaryrefslogtreecommitdiffstats
path: root/libziparchive
Commit message (Collapse)AuthorAgeFilesLines
* Merge "zip_archive: Improve error message on fallocate failure."Narayan Kamath2016-08-161-2/+3
|\ | | | | | | | | | | am: 704d818ec1 Change-Id: Ic1ab5e824dcc2b6a78e8ceb29732185ad5da1987
| * zip_archive: Improve error message on fallocate failure.Narayan Kamath2016-08-101-2/+3
| | | | | | | | | | | | Noticed on b/30765660. Change-Id: I1a98f83fef02a7368bdc2e1f8f24a0771eebe468
* | resolve merge conflicts of 41e82a3 to stage-aosp-masterColin Cross2016-07-122-106/+111
|\| | | | | | | Change-Id: I5a7faca3249f0c038914540b1dd29edf0084c0e1
| * Convert libziparchive from Android.mk to Android.bpColin Cross2016-07-122-106/+111
| | | | | | | | Change-Id: I6f0df9046b848ee8b841ae0a608a6adc981788e7
* | Merge "Fix google-explicit-constructor warnings." am: e1d5c25Chih-hung Hsieh2016-04-261-3/+5
|\| | | | | | | | | | | | | | | | | am: e641a2f * commit 'e641a2fa619c29dc25c329520ea300c21f908dcc': Fix google-explicit-constructor warnings. Change-Id: I461fe586fd8d23fa5abbe94859e609c29fbe889a
| * Fix google-explicit-constructor warnings.Chih-Hung Hsieh2016-04-251-3/+5
| | | | | | | | | | Bug: 28341362 Change-Id: I5d1988efc1563efbdb25c867713c54f41439a82a
| * libziparchive: port unit tests to darwin and windows.Yabin Cui2016-02-084-117/+72
| | | | | | | | | | | | | | | | | | 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
* | libziparchive: ensure ReadAtOffset is atomicAdam Lesinski2016-03-091-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | libziparchive: port unit tests to darwin and windows.Yabin Cui2016-03-074-117/+72
|/ | | | | | | | | | 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)
* Allow setting an arbitrary alignment for an entry.Christopher Ferris2016-01-192-6/+156
| | | | | | | | | The current code only allows the creation of an entry that is 32 bit aligned. Bug: 25446938 Change-Id: I6c924df12ef2bc067b3de7789257af7e3db7e904
* Add a ZipArchiveStreamEntry class.Christopher Ferris2016-01-147-117/+580
| | | | | | | | | 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
* Track rename of base/ to android-base/.Elliott Hughes2015-12-044-6/+6
| | | | Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
* Fix bug in writing zips.Christopher Ferris2015-11-052-10/+62
| | | | | | | | | 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
* Merge "ZipWriter: archive disk numbers are 0 index based"Adam Lesinski2015-10-301-2/+2
|\
| * ZipWriter: archive disk numbers are 0 index basedAdam Lesinski2015-10-201-2/+2
| | | | | | | | | | | | Misunderstood that disk numbers were 1 index based. Change-Id: I0c1f43436f1c5e9394818ad12164f6d7b982cbd8
* | Merge "Add deflate compression to ZipWriter"Adam Lesinski2015-10-303-68/+228
|\|
| * Add deflate compression to ZipWriterAdam Lesinski2015-10-203-68/+228
| | | | | | | | | | | | Use zlib to deflate compress data into the zip file. Change-Id: If094b926a67e199be976c3190781cd0101dd66e1
* | libziparchive: fix calculation of mod_time.beonit2015-10-302-1/+2
|/ | | | | | | | 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
* Implement ZipWriter for quickly writing ZipFiles.Adam Lesinski2015-10-155-162/+597
| | | | | | | | 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
* Remove USE_MINGW/CYGWIN; Whitelist windows modulesDan Willemsen2015-09-021-3/+2
| | | | | | | | CYGWIN is not supported, USE_MINGW and HOST_OS==windows are being replaced with LOCAL_..._windows variables. Bug: 23566667 Change-Id: I3e4a1e4097dc994cf5abdce6939e83a91758fd75
* Fix ODR issues in ART.Evgenii Stepanov2015-06-291-2/+2
| | | | | | | | Linking against both libziparchive-host and libz-host results in libz loaded twice (because it is also linked statically in libziparchive). Change-Id: Ib34eef60200a702c2d7fbca3589b324992e78eab
* Rename ZipEntryName to ZipStringYusuke Sato2015-06-262-67/+63
| | | | | | | | | | 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
* Add |optional_suffix| to StartIteration()Yusuke Sato2015-06-252-14/+141
| | | | | | | | | | so that PackageManagerService can iterate over files with a specific file extension like ".so". (cherry picked from commit a4a80693d9687982461decdcf86920b3e76bb41a) Bug: 21957428 Change-Id: I36ba3c33a8b366a65f67cb6d156067c5caca1151
* Fix whitespace in debug logging.Elliott Hughes2015-06-041-1/+1
| | | | Change-Id: I949317deaf782fea18b5c38b22dfd41811608276
* libziparchive: fix fallocate failuresBadhri Jagan Sridharan2015-06-031-1/+6
| | | | | | | | | | | | | | | | 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
* Revert "Fix ODR issues in ART."Evgeniy Stepanov2015-05-301-2/+2
| | | | | | | | Fails build on Mac. This reverts commit 2148a1243ea9bfe2df491d39f63bd6d813dda252. Change-Id: Ib4f0ba0b0a42500f20b7d73ca91363477fe3d093
* Fix ODR issues in ART.Evgenii Stepanov2015-05-281-2/+2
| | | | | | | | | | 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
* Use base::WriteFully in zip_archive.Narayan Kamath2015-04-291-16/+7
| | | | | | | | | | 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
* libziparchive: fix clang buildGreg Hackmann2015-04-271-4/+0
| | | | | Change-Id: I69105a9cde05b182f65c7e574282bb4b48b66e95 Signed-off-by: Greg Hackmann <ghackmann@google.com>
* Avoid mapping output to memory while writing to a file.Narayan Kamath2015-04-272-90/+269
| | | | | | | It's unnecessary, and causes issues when the uncompressed output is large. Change-Id: I99cfb3933b094c2826c7e6c6de9aab03478fcc53
* Reserve space on disk using fallocateƁukasz Szymczyk2015-04-201-1/+16
| | | | | | | | | | | | | | | | | | | | 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
* Prevent unaligned read in libziparchive.Dan Albert2015-04-092-22/+21
| | | | Change-Id: I4afc3729a1b2c06a6621cb8c9742fc94b5a665f5
* Remove LOCAL_ADDITIONAL_DEPENDENCIES in cases where it's not needed.Elliott Hughes2015-04-021-5/+0
| | | | Change-Id: I720b8ef1050da45a7833adef8219b6acb2cf3a38
* libziparchive: fix extraction of >2GiB imagesGreg Hackmann2015-03-231-1/+1
| | | | | | | Bug: 19888174 Change-Id: I33a577909ced522d46223e2182e0bb18c291af27 Signed-off-by: Greg Hackmann <ghackmann@google.com>
* libziparchive: fix issue with a directory with one fileMykola Kondratenko2015-03-193-1/+17
| | | | | | | | | 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
* Allocate buffers on the heapDmitriy Ivanov2015-03-121-9/+10
| | | | Change-Id: I96c8a50e8987e8ea77d0766ccf3c619f60377864
* Remove some more gotosDmitriy Ivanov2015-03-061-14/+13
| | | | Change-Id: I9c4b3a5aecf4011653933b051e67605a6feb123f
* Reapply -Wold-style-castDmitriy Ivanov2015-03-062-1/+10
| | | | | | | Added pragmas to disable checks for the method using libz.h macros. Change-Id: I25aa1adf09f3ecff61d8fea6306b24b37990ab46
* Fix build: Remove -Wold-style-castDmitriy Ivanov2015-03-061-1/+0
| | | | | | libz.h has macros using old-style-cast. Change-Id: I48f7d85805c7c34e1453c863da3c9e734a57d479
* Remove some gotosDmitriy Ivanov2015-03-061-13/+8
| | | | Change-Id: I0e162c8e0a700940f4302786b8523e5b2f5e5c27
* Cleanup old-style-cast warningsDmitriy Ivanov2015-03-062-23/+28
| | | | Change-Id: I6e17fd993557cbf78ade787f112794358aee39c8
* Remove unnecessary allocation of FileMapsDmitriy Ivanov2015-03-061-34/+12
| | | | Change-Id: I97bb72b9edeee5b3eff4ffd21a761a1af472a3b5
* Remove useless refCounting from FileMap.Narayan Kamath2015-02-231-5/+3
| | | | | | | | | 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
* Add close_file flag to OpenArchiveFd()Dmitriy Ivanov2015-01-302-5/+29
| | | | | | * We should be able to keep fd alive after CloseArchive() Change-Id: I1aa2c039bb2a590ae72f256acc9ba5401c2c59b1
* Merge "Reject zip archives whose entry names are not valid UTF-8."Narayan Kamath2014-12-084-5/+128
|\
| * Reject zip archives whose entry names are not valid UTF-8.Narayan Kamath2014-12-084-5/+128
| | | | | | | | | | bug: 18584205 Change-Id: Iaf3e8211dab6a1e3923f7fee6ea7fc693972dba3
* | Clean up libziparchive Android.mkTrevor Drake2014-12-061-6/+0
|/ | | | | | | | | | | | | | | 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
* Libziparchive: Remove unused variableAndreas Gampe2014-11-241-1/+0
| | | | | | For build-system CFLAGS clean-up, remove unused variable. Change-Id: Icc33cf5d0a5fe9a77c277b100de01b70164cc351
* kill HAVE_PREADYabin Cui2014-11-191-2/+2
| | | | | Bug: 18397613 Change-Id: I3990bd0f95cf38c5a9229180a1ddc699941892fc
* am 7a92d20e: Merge "Clean up some test makefiles."Dan Albert2014-11-051-20/+12
|\ | | | | | | | | * commit '7a92d20ec845c07472eaea7cf14fd0e69df836ef': Clean up some test makefiles.