summaryrefslogtreecommitdiffstats
path: root/libsparse
Commit message (Collapse)AuthorAgeFilesLines
* Build adbd for recoveryJiyong Park2018-05-241-0/+1
| | | | | | | | | | | | | adbd (and its dependencies) are marked as recovery_available:true so that recovery version of the binary is built separately from the one for system partition. This allows us to stop copying the system version to the recovery partition and also opens up the way to enable shared libraries in the recovery partition. Then we can also build adbd as a dynamic executable. Bug: 79146551 Test: m -j adbd.recovery Change-Id: Ib95614c7435f9d0afc02a0c7d5ae1a94e439e32a
* libsparse: Use 'size_t' for the 'len' parameter in callbacks.Tao Bao2018-04-254-11/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL updates the callback function signature in sparse_file_callback() and sparse_file_foreach_chunk(). Before: int sparse_file_callback( struct sparse_file *s, bool sparse, bool crc, int (*write)(void *priv, const void *data, int len), void *priv); int sparse_file_foreach_chunk( struct sparse_file *s, bool sparse, bool crc, int (*write)( void *priv, const void *data, int len, unsigned int block, unsigned int nr_blocks), void *priv); After: int sparse_file_callback( struct sparse_file *s, bool sparse, bool crc, int (*write)(void *priv, const void *data, size_t len), void *priv); int sparse_file_foreach_chunk( struct sparse_file *s, bool sparse, bool crc, int (*write)( void *priv, const void *data, size_t len, unsigned int block, unsigned int nr_blocks), void *priv); The length (i.e. 'len') comes from the size of a chunk, which could be legitimately larger than INT_MAX. Prior to this CL, callers (e.g. write_sparse_data_chunk()) were already passing unsigned int to the callbacks. When a chunk size exceeds INT_MAX, the callback would see a negative value, which could lead to undesired behavior. For example, out_counter_write(), as one of the internal callbacks in libsparse, gives a wrong sum of chunk sizes, which in turn fails the fastboot flashing when given a huge sparse image. It also defines SPARSE_CALLBACK_USES_SIZE_T that allows clients to keep their codes compatibile with both versions. Bug: 78432315 Test: `m dist` (with matching changes to all the clients) Test: Build fastboot and successfully flash a previously failing (huge) sparse image. Change-Id: Iac4bcf7b57039d08af3c57f4be00d75f6b693d93
* Merge "<stdbool.h> not necessary in C++."Treehugger Robot2017-10-171-1/+0
|\
| * <stdbool.h> not necessary in C++.Elliott Hughes2017-10-171-1/+0
| | | | | | | | | | | | | | Bug: N/A Test: builds Change-Id: I1f32b202e353414e74ace87a7d5b495b5deb5f99 Merged-In: I1f32b202e353414e74ace87a7d5b495b5deb5f99
* | libsparse: fix building on linux host.Xiaolei Yu2017-10-111-0/+1
| | | | | | | | | | | | | | | | memset is declared in <string.h> Test: builds and works on host Change-Id: I224a01c78ee1d0c2f8d5e86eef10c84c8960cbc0
* | Rename libz-host -> libzDan Willemsen2017-09-271-12/+4
|/ | | | | Test: m host Change-Id: Ib276431d13b3e1bd243f84a80f69aafc12e71aac
* Merge "libsparse: Fix odd-sized input files total_blks" am: 652ce94f40 am: ↵Chris Fries2017-04-191-1/+1
|\ | | | | | | | | | | | | | | ab74c778df am: cbd8d9d4f5 Change-Id: I3c7afcd7a3a3bab4460123751d0a5696cb1892c6
| * libsparse: Fix odd-sized input files total_blksChris Fries2017-04-191-1/+1
| | | | | | | | | | | | | | | | | | | | If the input file isn't a multiple of block_size, count the trailing bit as a block in the output, otherwise bootloader will try to write past the last declared block in the sparse file. Test: Run sparse_test Bug: 37339998 Change-Id: Iec143107d15795c6a6f4d3ea7b7515f6f16adcae
* | Merge "libsparse: Fix verbose_error string usage" am: 0bdf6539d6 am: 006ea1aebcChris Fries2017-04-185-53/+60
|\| | | | | | | | | | | am: 5a07296873 Change-Id: I0e96c2b6212b115e4a3098cf462d5e5686a6de4a
| * libsparse: Fix verbose_error string usageChris Fries2017-04-185-53/+60
| | | | | | | | | | | | | | | | | | Switch vnsprintf to StringPrintf to avoid off-by-one, and switch sparse_read.c to cpp. Test: fastboot flash normal image with smaller sparse limit Change-Id: Ia399b167625deb271bfd0ee3273071306d71c4d4
* | Remove "_host" and "_static" suffix from libsparse definition. am: ↵Alex Deymo2017-01-121-24/+13
|\| | | | | | | | | | | | | | | b0c395955d am: 7b8d66e7cc am: 11b65cf3be am: 092a732ef2 Change-Id: I3d9639af9f9f66742660edbbf62f73909c0d6915
| * Remove "_host" and "_static" suffix from libsparse definition.Alex Deymo2017-01-111-24/+13
| | | | | | | | | | | | | | | | | | | | | | | | This now combines all the "libsparse" libraries into the same soong target. A minor side-effect of this change is that the libsparse static library depends on the libz shared library instead of the libz static library. This minor change has no effect since targets using the static libsparse library need to explicitly include either the static libz or the shared one. Bug: 34220783 Change-Id: I8f41586cf4c3336791cfa57ab4f5ae59a76d7ffa
* | Manually merge commit '61e74d7' into stage-aosp-master am: 9f9a239ca3 am: ↵Adrien Schildknecht2016-12-032-0/+81
|\| | | | | | | | | | | | | | | aec7316546 am: 669716d27c Change-Id: I75f9c115fe178008174f1fea8cb8b890b83c2543
| * libsparse: add a function to retrieve the data blocksAdrien Schildknecht2016-11-302-0/+81
| | | | | | | | | | | | Test: m libsparse Change-Id: I04bd3912bb4364e591b064ec2aab782cf02f6bd7
* | Merge "libsparse: output_file.c, fix large data chunk issue" am: 62c9101646 ↵Colin Cross2016-10-071-21/+30
|\| | | | | | | | | | | | | | | am: faaeda8e12 am: 4179f2ec65 am: c0422d1b2a Change-Id: I812e1f268fa8c3a1ba8b5555319424cadf07a707
| * libsparse: output_file.c, fix large data chunk issueJeremy Compostella2016-10-061-21/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CHUNK_HEADER structure type allows DATA chunk to be up to MAX_UINT large. The write() callback LEN parameter should be unsigned int. Also: - write() callback should continue to write data if less than expected data have been written. - gzerror() returns LEN on success, 0 otherwise Test: manual Change-Id: Id46d664b84c1a506f419524fe28055f784c2ae7a Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
* | Merge "Test for _WIN32 in instead of USE_MINGW." am: ec99158580 am: ↵Elliott Hughes2016-10-052-4/+4
|\| | | | | | | | | | | | | | | 2e7e065db9 am: 04819403d6 am: c9dc124e2f Change-Id: I2cfb73fc12da1bb6396bfdd8f638b9ce977f84bc
| * Test for _WIN32 in instead of USE_MINGW.Elliott Hughes2016-10-052-4/+4
| | | | | | | | | | | | Bug: http://b/23392815 Test: builds Change-Id: I7fce8de1f0e2314170cce456cd49346dcee9d134
* | libsparse: Add .csv and sha1 options for simg_dump.pyPatrick Tjin2016-10-031-39/+91
|/ | | | | | | | | | | Adds CSV output option to output blocks to a CSV file. Adds option to output SHA1 sum for each block. Addressed misc lint errors Test: compared output with previous version Change-Id: I555c8816c6ef2b0b69dac2b9789fbfd8b2786a49
* Convert more Android.mk files to Android.bpDan Willemsen2016-07-132-100/+78
| | | | | | | These modules have their dependencies satisfied, and aren't doing anything strange. Change-Id: I72039a15256cbd5e5eee0d79a15d66d74a6c087d
* Fix misc-macro-parentheses warnings in libion, libsparse, libmem*Chih-Hung Hsieh2016-05-181-1/+1
| | | | | Bug: 28705665 Change-Id: I3dd5c086787f5e48ab100a71a42109ea0e417bf9
* Fix static analyzer issues caught by clangColin Cross2016-02-011-3/+5
| | | | | | | | | | | | | | | system/core/libsparse/sparse_read.c:260:51: warning: Dereference of null pointer (loaded from variable 'crc_ptr') ret = process_crc32_chunk(fd, chunk_data_size, *crc_ptr); system/core/libsparse/sparse_read.c:404:9: warning: Potential leak of memory pointed to by 'buf' return 0; Fixes leak in sparse_file_read_normal, and null pointer dereference crash if an image with an obsolete CRC chunk was read with CRC checking disabled. Bug: 26904425 Change-Id: Ibc72cd37602929ae2c248bea1cdd1d22ea03baaf
* Turn off CRC checking for append2simgColin Cross2015-12-171-1/+1
| | | | | | | | make_ext4fs doesn't write out a CRC chunk, and append2simg doesn't either, but append2simg was still performing a CRC on every input block. Cuts append2simg time in half. Change-Id: I678f807abbb741042461ed68a0f61b406d3665fb
* Fix parameter to lseekcaozhiyuan2015-10-201-4/+5
| | | | Change-Id: I9c497a3ebc24ca1db92d0b9d3d1e9ac49dc40f75
* fix misuse of formatting specifiersDaniel Micay2015-10-131-5/+6
| | | | | | | | | | | The Clang/GCC formatting warning triggers for usage of %lld with off_t on 64-bit because it's defined as a long int, not a long long int. It isn't important, but it's technically undefined. This fix is in anticipation of adding __attribute__((format(...))) to many functions where it is currently missing. Change-Id: I2bf33e6563a2892d2f54d7c582cbdeadf867e84f
* Remove USE_MINGW/CYGWIN; Whitelist windows modulesDan Willemsen2015-09-021-0/+1
| | | | | | | | CYGWIN is not supported, USE_MINGW and HOST_OS==windows are being replaced with LOCAL_..._windows variables. Bug: 23566667 Change-Id: I3e4a1e4097dc994cf5abdce6939e83a91758fd75
* libsparse: use strcmp and validate last_used pointerlei wang wang2015-08-211-2/+6
| | | | | | | | | | | | | This patch is used to fix two Bugs in backed_block.c First, fix wrong comparing string way: we should use strcmp rather than just compare their address. Second, fix using illegal memory risk in bbl->last_used pointer. When entering queue_bb function, bbl->last_used = new_bb, but in the following code if queue_bb(xx, bb, new_bb) return ok, the space of new_bb is released. So next time, if you use bbl->last_used pointer, may cause segment fault ! Change-Id: I6abb505f9b903b697448639fc64fb7518df5cca1
* libsparse: Wrap sparse_crc32.h to be C++ compatible.Tao Bao2015-07-111-0/+12
| | | | Change-Id: Ic6b1721859937984619a262c459f1f734d81c149
* libsparse: fix crc chunk parsing in simg_dump.pyEric Miao2015-04-301-1/+1
| | | | Change-Id: Ia5b7cedd88809b0e421a056704d25afa190470b8
* libsparse: move_chunks_up_to_len() does not account skip chunksJeremy Compostella2015-04-081-3/+10
| | | | | | | | | I caught the fastboot host command sending more data than the fastboot device can accept. Fastboot host command was sending 36 surplus bytes because of 3 skip chunks that were not taken into account in move_chunks_up_to_len() algorithm. Change-Id: I39a4a033c9b15893bd70e553f17116735ee4a48e
* Add verbose param to sparse_file_import_autoMohamad Ayyash2015-03-313-4/+5
| | | | | Change-Id: I0c5607f7aa5e964abc2031bbe71ff5c6e6ef56cc Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
* fastboot/sparse: propagate error codeJeremy Compostella2015-03-011-12/+27
| | | | | | | | | | | sparse_file_write_block calls functions that might failed. This patch makes sparse_file_write_block catch the error code and propagate it. Without this patch, fastboot crashes on a segmentation fault if usb_write() fail during a sparse file image flashing. Change-Id: If9c0e8dfac8fa380628a2504e13abe8cf7d62726 Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
* Cleanup libsparse Android.mkTrevor Drake2014-12-121-3/+3
| | | | | | Removed unnecessary external/zlib reference from LOCAL_C_INCLUDES Change-Id: Ib61da00dc1e0eac89a68f244881b12e2a4e92e64
* am d4d09637: am db32e788: am a2b03c4a: Merge "libsparse: turn on -Werror"Mark Salyzyn2014-05-085-19/+14
|\ | | | | | | | | * commit 'd4d096370154492433f02df56a7508eb99f564e2': libsparse: turn on -Werror
| * libsparse: turn on -WerrorMark Salyzyn2014-05-075-19/+14
| | | | | | | | | | | | - Deal with some -Wunused issues Change-Id: I9667d74c0dfbe55c625e65b9d44d7c6f861c455d
* | append2simg: write to temporary fileColin Cross2014-04-252-1/+32
| | | | | | | | | | | | | | | | | | | | append2simg causes libsparse to write mmapped data from a file back to that same file. On btrfs, this sometimes causes a page of zeroes to be written instead of the file data. Work around the issue by writing the output to a temporary file and then renaming it over the original file. Change-Id: Ia194b6ba0ddb8548747b63292b523756f544706a
* | am 37d39eba: am 0cb82da2: am 958235bd: Merge "libsparse: allow including ↵Colin Cross2014-04-181-0/+8
|\| | | | | | | | | | | | | from C++" * commit '37d39eba0b3da124be747dd6a014332817135264': libsparse: allow including from C++
| * libsparse: allow including from C++Colin Cross2014-04-181-0/+8
| | | | | | | | Change-Id: I3788fd07e2b52430a410f85fb79dc886c6a07fea
* | am d9f1702a: am 2b6791d0: am 0577a067: Merge "libsparse: deal with build ↵Mark Salyzyn2014-02-284-6/+34
|\| | | | | | | | | | | | | warning messages" * commit 'd9f1702a10541b59cfc9582762360d3347712e09': libsparse: deal with build warning messages
| * libsparse: deal with build warning messagesMark Salyzyn2014-02-284-6/+34
| | | | | | | | | | | | | | - mostly unused parameters, added defs.h to hold __unused macro - read_all prototype not included, added output_file.h to acquire Change-Id: Ib7ee00614acab53a6bd6a64f7e26a8c13dbe6297
* | resolved conflicts for merge of ec9e5891 to masterElliott Hughes2014-01-161-1/+2
|\| | | | | | | Change-Id: I704e3159d529e436e060cb66c1739ef8e7b612d4
| * system/core 64-bit cleanup.Elliott Hughes2014-01-161-1/+2
| | | | | | | | | | | | | | | | | | This cleans up most of the size-related problems in system/core. There are still a few changes needed for a clean 64-bit build, but they look like they might require changes to things like the fastboot protocol. Change-Id: I1560425a289fa158e13e2e3173cc3e71976f92c0
* | am 9259663c: am f17f5591: am 36d44740: Merge "Fix a bunch of small ↵Elliott Hughes2013-10-292-1/+3
|\| | | | | | | | | | | | | system/core bugs." * commit '9259663cdb8f15226844e3ecfc6e3aa53614ad03': Fix a bunch of small system/core bugs.
| * Fix a bunch of small system/core bugs.Elliott Hughes2013-10-292-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Missing frees in: adb/file_sync_client.c fastboot/fastboot.c libsparse/output_file.c Missing closedirs in: adb/file_sync_service.c cpio/mkbootfs.c libcutils/dir_hash.c Potential buffer overrun in: gpttool/gpttool.c Incorrect NULL check in: libsparse/backed_block.c Bug: https://code.google.com/p/android/issues/detail?id=61564 Change-Id: If97838a9e73a77aef7f416c31c237ce1fca4ce21
* | am 4d5d633b: am 20eb7ac2: am 3c8bdef0: Merge "libsparse: Use BIONIC ↵Elliott Hughes2013-09-201-9/+0
|\| | | | | | | | | | | | | implementation of mmap64()" * commit '4d5d633bf862dbb0a960019e80fadc40c93177f0': libsparse: Use BIONIC implementation of mmap64()
| * libsparse: Use BIONIC implementation of mmap64()Daniel Leung2013-09-181-9/+0
| | | | | | | | | | Change-Id: I63692629d3a62b7aee21202b67241904b1cc9789 Signed-off-by: Daniel Leung <daniel.leung@intel.com>
* | Add append2simg.Geremy Condra2013-08-062-2/+114
|/ | | | | | | | Append2simg is a small utility designed to glue data to the end of a sparse image. Beware that it doesn't do anything clever with that data. Change-Id: I33af330cb4f77e0842375797a35aebbb6af60163
* libsparse: Fix null pointer issueHong-Mei Li2013-04-011-0/+3
| | | | | | | Fix the issue that "out" pointer is dereferenced without checking. Change-Id: I76a57ad7309841218231346f4807ef2be8628737 Signed-off-by: Hong-Mei Li <a21834@motorola.com>
* Support for multiple modules with the same name is going away.Joe Onorato2012-08-151-37/+35
| | | | Change-Id: I5006b467978071f9107babe532efa71d05061580
* libsparse: fix 32 bit overflow when calculating last chunkColin Cross2012-07-231-1/+1
| | | | | | | last_block * s->block_size can overflow when writing large filesystems, cast to 64 bits before multiplying. Change-Id: I3e54097852ce7d0fd271eab53d65e666284898e4