Fix SEGV in libziparchive with malformed zip file.
d77c99eb 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
Loading
Please register or sign in to comment