summaryrefslogtreecommitdiff
path: root/base/mapped_file_test.cpp
AgeCommit message (Collapse)Author
2020-05-19Migrate system/core/base to system/libbaseBaligh Uddin
BUG: 148941208 test: TH Change-Id: I1134f1e9e968b9273748e2483bea8d25e5c9e994
2019-12-17Fix SEGV in libziparchive with malformed zip file.Elliott Hughes
d77c99ebc3d896501531e9522b690c4a0e971aff changed MappedFile to return a bogus zero-length mapping on failure rather than nullptr. None of the calling code was changed, though, and it seems like doing so would be a bad idea. Revert that part of the change. Add missing tests, and tidy up some of the logging. Also remove single-use or obfuscatory constants from the tests. The new "empty.zip" was created by using zip(1) to create a zip file with one entry, then using `zip -d` to remove it. The new "zero-size-cd.zip" was created by using zip(1) to create a zip file containing a single empty file, and then hex editing the two byte "size of the central directory" field in the "end of central directory record" structure at the end of the file. (This is equivalent to, but much smaller than, the example zip file provided by the bug reporter.) Bug: http://b/145925341 Test: treehugger Change-Id: Iff64673bce7dae886ccbc9dd6c2bbe18de19f9d2
2019-08-14[base] Make MappedFile work with OS file handlesYurii Zubrytskyi
adb uses its own implementation of Windows HANDLE->int mapping, and it doesn't play well with _get_osfhandle() function used in MappedFile::FromFd(). This CL adds another function that accepts raw handle, so adb can pass it directly + make constant functions 'const' + make the MappedFile movable, as nothing prevents it from being one Test: libbase_test Change-Id: Ifde4a4094b910e9c7b431126ecf3fef5aa3bb4a6
2019-02-06MappedFile and FileMap should support zero-length mappings.Elliott Hughes
Bug: http://b/119818070 "app crashes when reading asset of zero length" Test: ran tests Change-Id: Idd2ad6f6e72c8e445aff78a460fac96dea41c950
2018-11-14switch to using android-base/file.h instead of android-base/test_utils.hMark Salyzyn
Test: compile Bug: 119313545 Change-Id: I4f7ad84743e974b4b4d1d7256088f6c8b749a237
2018-10-23Add a simple MappedFile to libbase and switch fastboot and libziparchive over.Elliott Hughes
This allows us to remove libziparchive's dependency on libutils. Bug: http://b/79112958 Test: ran libbase and libziparchive tests, ran fastboot manually Change-Id: I95c651976dad222863e5b8c37d4514b778f5dce7