Treat absolute paths in zip files as relative
Absolute paths in zip files are invalid, as per the APPNOTE:
4.4.17 file name: (Variable)
4.4.17.1 The name of the file, with optional relative path.
The path stored MUST not contain a drive or
device letter, or a leading slash. All slashes
MUST be forward slashes '/' as opposed to
backwards slashes '\' for compatibility with Amiga
and UNIX file systems etc. If input came from standard
input, there is no file name field.
However, zip files in the wild and ones generated by some services do
have them, so they should be handled in a reasonable manner, as other
platform (including Google Drive) do. Stripping the leading slash and
treating the path as relative seems reasonable. This won't work if there
are two files with the same path, but one being relative and the other
absolute. But in this case, the archive was already invalid, so any
attempt to handle it is best effort.
BUG=646850
Change-Id: I7681e888bb78d7f4f53c7bd3a5ab318bffb8c527
Reviewed-on: https://chromium-review.googlesource.com/c/1301094Reviewed-by:
Tatsuhisa Yamaguchi <yamaguchi@chromium.org>
Commit-Queue: Anand Mistry <amistry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603005}
Showing
File added
Please register or sign in to comment