summaryrefslogtreecommitdiffstats
path: root/libziparchive
Commit message (Collapse)AuthorAgeFilesLines
* Fix out of bound access in libziparchiveTianjie Xu2016-12-121-1/+6
| | | | | | | | | | | | | | 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. CYNGNOS-3312 Bug: 31251826 Change-Id: I1d8092a19b73886a671bc9d291cfc27d65e3d236 (cherry picked from commit ae8180c06dee228cd1378c56afa6020ae98d8a24) (cherry picked from commit 1ee4892e66ba314131b7ecf17e98bb1762c4b84c) (cherry picked from commit 7f246f7fdd2f003c6f3701f599052a2040af6bfb)
* Add |optional_suffix| to StartIteration()Yusuke Sato2015-06-232-14/+141
| | | | | | | | so that PackageManagerService can iterate over files with a specific file extension like ".so". Bug: 21957428 Change-Id: I76ed9560d4d1e00d297a97d518ec357166be1981
* libziparchive: fix fallocate failuresBadhri Jagan Sridharan2015-06-041-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: http://b/21558406 Bug: 21561449 Change-Id: I7083f3c7e5d745bd6e8a190ac9020297d638d9d4 (cherry picked from commit a68d0d1fe48afc7a7a7fd0ee42df1607f21fa996)
* Use base::WriteFully in zip_archive.Narayan Kamath2015-06-041-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) Bug: http://b/21558406 Change-Id: I294ad389a9c61a1134a7bc323da25b0004a8f1e0 (cherry picked from commit e97e66ea7c624190afa4639d6ddc60e7d013f46c)
* libziparchive: fix clang buildGreg Hackmann2015-06-041-4/+0
| | | | | | | Bug: http://b/21558406 Change-Id: I69105a9cde05b182f65c7e574282bb4b48b66e95 Signed-off-by: Greg Hackmann <ghackmann@google.com> (cherry picked from commit d6eac24aac0069cb6d00d2c723db5adab1a724c4)
* Avoid mapping output to memory while writing to a file.Narayan Kamath2015-06-042-90/+269
| | | | | | | | | It's unnecessary, and causes issues when the uncompressed output is large. Bug: http://b/21558406 Change-Id: I99cfb3933b094c2826c7e6c6de9aab03478fcc53 (cherry picked from commit f899bd534b2dc51b9db8d27c76394b192fe51155)
* 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.
| * Clean up some test makefiles.Dan Albert2014-11-041-20/+12
| | | | | | | | | | | | | | Needed for building with libc++ as the default STL. Bug: 15193147 Change-Id: I8b462bd288fbea7e0ab182f85ffcbf438afb6aa4
* | am b968d5c8: Merge "Add shared library version of libziparchive."Ian Rogers2014-10-301-2/+15
|\ \ | |/ | | | | | | * commit 'b968d5c8468c9b0707f88f773fae16074e9018cf': Add shared library version of libziparchive.
| * Add shared library version of libziparchive.Ian Rogers2014-10-301-2/+15
| | | | | | | | Change-Id: I9abded3bbff0e7976b1849c73e6978dd10ca84cd
* | am cd1da4e0: Fix toolchain issue for windows build of libziparchive.Xavier Ducrohet2014-10-161-0/+3
|\ \ | |/ |/| | | | | * commit 'cd1da4e04f0eb71a92a586c66acd0e34115608e1': Fix toolchain issue for windows build of libziparchive.
| * Fix toolchain issue for windows build of libziparchive.Xavier Ducrohet2014-10-161-0/+3
| | | | | | | | | | | | | | | | | | | | 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
| * Reject zip archives with entry names containing \0.Piotr Jastrzebski2014-08-261-1/+7
| | | | | | | | | | | | | | | | | | | | There should never be a need of an entry name with \0 character. Bug: 16162465 (cherry picked from commit 78271ba97b5d867e3597b7fc2257dd1bbd513b05) Change-Id: I68c72fb45e8ec70eb125cfc887488bc18ba5447d
| * Prevent the accidental closure of fd[0] for missing zip files.Neil Fuller2014-07-282-22/+33
| | | | | | | | | | | | | | (cherry picked from commit b1a113f618561b274ab793e6401416d449c60449) Bug: 16530747 Change-Id: I0d1be3dcadfa5128ffe04cec60f6c998dff61991
* | Merge "Reject zip archives with entry names containing \0."Piotr Jastrzebski2014-08-161-1/+7
|\ \
| * | Reject zip archives with entry names containing \0.Piotr Jastrzebski2014-08-191-1/+7
| | | | | | | | | | | | | | | | | | | | | There should never be a need of an entry name with \0 character. Bug: 16162465 Change-Id: Ia2ec57959280c1bb972c4d59d890c8540c5b9081
* | | Cleanup ziparchivePiotr Jastrzebski2014-08-191-3/+4
|/ / | | | | | | | | | | Addressed review comments from 8e08536108d2b5a7f4f9a4b008987b54602fda18 Change-Id: If576e2d6cc5ad330a7dee66b09663e0c04ea3801
* | Fix win_sdk build by not using vectorPiotr Jastrzebski2014-08-182-12/+20
| | | | | | | | Change-Id: I4e9ee4286ea29e1f5f2ee477525e79bfa16ad9a0
* | Replace char* with ZipEntryName in ziparchive API.Piotr Jastrzebski2014-08-153-48/+86
| | | | | | | | | | | | | | | | | | 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
* | Revert "Make sure that names of all entries have the same encoding."Piotr Jastrzebski2014-08-131-20/+1
| | | | | | | | | | | | This reverts commit 6a7f4bb79dde575d30af562af916b572b80ff9c3. Change-Id: Id4f5b601ff0b9d82ce2c9beeb9162eba9594b3a7
* | Make sure that names of all entries have the same encoding.Piotr Jastrzebski2014-08-131-1/+20
| | | | | | | | | | | | | | | | 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
* | Make a copy of a prefix param in StartIterationPiotr Jastrzebski2014-08-111-1/+7
| | | | | | | | | | | | and delete it in EndIteration. Change-Id: I4de4167700a9dba3119fde22fcd45725742f3731
* | Add EndIteration method to free memory allocatedPiotr Jastrzebski2014-08-111-0/+6
| | | | | | | | | | | | | | 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
* | Merge "Prevent the accidental closure of fd[0] for missing zip files."Neil Fuller2014-07-232-22/+33
|\ \
| * | Prevent the accidental closure of fd[0] for missing zip files.Neil Fuller2014-07-252-22/+33
| |/ | | | | | | | | Bug: 16530747 Change-Id: I3593f2bc4d56a2f91252ea795c90ce3c78e1ec06
* | Update makefiles for host clang.Tim Murray2014-07-241-1/+2
|/ | | | | | bug 16172793 Change-Id: If7484c5dbcccce7d925bec97bff0a3e4c30e9434
* Enable host multilib for ART testing.Ian Rogers2014-06-171-0/+1
| | | | Change-Id: Ic3ae5122eba13565fb5a4cb1bd0e7e465fb2140c
* Replace hand written offsets with structures.Narayan Kamath2014-06-102-160/+272
| | | | | | | | | | | | | | 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
* Fix build.Narayan Kamath2014-06-061-2/+2
| | | | | | Uncommitted changes from a rename. Change-Id: If1cac7104c436970f905eede683040ae79529292
* Reject zip files that have trailing bytes after their CD.Narayan Kamath2014-06-052-12/+38
| | | | | bug: 15287086 Change-Id: I03219c4c2ca6afc9d417a35bd98ae682f478fc25
* Fix host 64-bit build.Ying Wang2014-05-161-2/+2
| | | | | Bug: 13751317 Change-Id: Ib42d24408d053bacc24142ed18fc5f3181d2345b