platform_system_core/libziparchive
Adam Lesinski de117e4a49 libziparchive: Use ReadAtOffset exclusively
The use of ReadAtOffset is meant to allow concurrent access
to the zip archive once it has been loaded. There were places
where this was the case, and some places that did a seek + read
combination, which could lead to data races.

NOTE: On Windows, we are not using pread as the implementation of
ReadAtOffset, therefore the guarantees on Windows are weaker.

On Linux, pread allows the file descriptor to be read at a specific
offset without changing the read pointer. This allows inherited fd's
and duped fds to be read concurrently.

On Windows, we use the ReadFile API, which allows for an atomic seek +
read operation, but modifies the read pointer. This means that any mix
use of ReadAtOffset and Read will have races. Just using ReadAtOffset is
safe.

For the Windows case, this is fine as the libziparchive code now only
uses ReadAtOffset.

Bug: 62184114
Bug: 62101783
Test: make ziparchive-tests (existing tests pass)
Change-Id: Ia7f9a30af2216682cdd9d578d26e84bc46773bb9
2017-07-25 18:12:12 +00:00
..
include/ziparchive libziparchive: Use ReadAtOffset exclusively 2017-07-25 18:12:12 +00:00
testdata Check filename memory bound when parsing ziparchive 2017-06-30 17:19:28 +09:00
.clang-format add a performance benchmark for libziparchive 2017-05-30 10:50:14 -07:00
Android.bp Libziparchive: Export headers in defaults 2017-07-05 22:03:44 -07:00
entry_name_utils-inl.h Ran clang-format on libziparchive sources and headers 2017-07-02 11:46:53 +09:00
entry_name_utils_test.cc Ran clang-format on libziparchive sources and headers 2017-07-02 11:46:53 +09:00
unzip.cpp Add libziparchive-based unzip. 2017-06-04 11:53:48 -07:00
zip_archive.cc libziparchive: Use ReadAtOffset exclusively 2017-07-25 18:12:12 +00:00
zip_archive_benchmark.cpp add a performance benchmark for libziparchive 2017-05-30 10:50:14 -07:00
zip_archive_common.h Ran clang-format on libziparchive sources and headers 2017-07-02 11:46:53 +09:00
zip_archive_private.h libziparchive: Use ReadAtOffset exclusively 2017-07-25 18:12:12 +00:00
zip_archive_stream_entry.cc libziparchive: Use ReadAtOffset exclusively 2017-07-25 18:12:12 +00:00
zip_archive_test.cc Ran clang-format on libziparchive sources and headers 2017-07-02 11:46:53 +09:00
zip_writer.cc Ran clang-format on libziparchive sources and headers 2017-07-02 11:46:53 +09:00
zip_writer_test.cc Ran clang-format on libziparchive sources and headers 2017-07-02 11:46:53 +09:00