unzip: give better error message when presented with unsupported
authorDenis Vlasenko <vda.linux@googlemail.com>
Sat, 26 Jul 2008 16:50:24 +0000 (16:50 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Sat, 26 Jul 2008 16:50:24 +0000 (16:50 -0000)
 zip file. Add zip documentation and an example of file we cant
 (yet) unpack.

archival/unzip.c
archival/unzip_cant_handle.odt [new file with mode: 0644]
archival/unzip_doc.txt.bz2 [new file with mode: 0644]

index 7c92f5d9a4f357e218afedacde6283981d13a2b7..36490cb416a2f96f8188c84c7706a5519906df0f 100644 (file)
@@ -99,6 +99,12 @@ static void unzip_create_leading_dirs(const char *fn)
 
 static void unzip_extract(zip_header_t *zip_header, int src_fd, int dst_fd)
 {
+       if (zip_header->formatted.flags & (0x0008|0x0001)) {
+               /* 0x0001 - encrypted */
+               /* 0x0008 - streaming. [u]cmpsize can be reliably gotten
+                * only from Central Directory. See unzip_doc.txt */
+               bb_error_msg_and_die("zip flags 8 and 1 are not supported");
+       }
        if (zip_header->formatted.method == 0) {
                /* Method 0 - stored (not compressed) */
                off_t size = zip_header->formatted.ucmpsize;
diff --git a/archival/unzip_cant_handle.odt b/archival/unzip_cant_handle.odt
new file mode 100644 (file)
index 0000000..715e4a9
Binary files /dev/null and b/archival/unzip_cant_handle.odt differ
diff --git a/archival/unzip_doc.txt.bz2 b/archival/unzip_doc.txt.bz2
new file mode 100644 (file)
index 0000000..ab77d10
Binary files /dev/null and b/archival/unzip_doc.txt.bz2 differ