summaryrefslogtreecommitdiff
path: root/source/xps
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2014-03-08 21:05:52 +0100
committerRobin Watts <robin.watts@artifex.com>2014-04-22 19:29:04 +0100
commita384d20ff9ea220635b6c38282b73d7c33af944a (patch)
treece44cb399b145f27319c01b928f0ab0e89b3dc58 /source/xps
parentbb57cfd5bebf922ad1f41c1a769eef39e4389ff6 (diff)
downloadmupdf-a384d20ff9ea220635b6c38282b73d7c33af944a.tar.xz
Error out on unsupported encrypted zip files
Diffstat (limited to 'source/xps')
-rw-r--r--source/xps/xps-zip.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/xps/xps-zip.c b/source/xps/xps-zip.c
index da1450e3..ec0fbc90 100644
--- a/source/xps/xps-zip.c
+++ b/source/xps/xps-zip.c
@@ -11,6 +11,8 @@
#define ZIP64_END_OF_CENTRAL_DIRECTORY_SIG 0x06064b50
#define ZIP64_EXTRA_FIELD_SIG 0x0001
+#define ZIP_ENCRYPTED_FLAG 0x1
+
static void xps_init_document(xps_document *doc);
xps_part *
@@ -103,6 +105,7 @@ xps_read_zip_entry(xps_document *doc, xps_entry *ent, unsigned char *outbuf)
z_stream stream;
unsigned char *inbuf;
int sig;
+ int general;
int method;
int namelength, extralength;
int code;
@@ -117,7 +120,12 @@ xps_read_zip_entry(xps_document *doc, xps_entry *ent, unsigned char *outbuf)
}
(void) getshort(doc->file); /* version */
- (void) getshort(doc->file); /* general */
+ general = getshort(doc->file); /* general */
+ if (general & ZIP_ENCRYPTED_FLAG)
+ {
+ fz_throw(doc->ctx, FZ_ERROR_GENERIC, "zipfile content is encrypted");
+ }
+
method = getshort(doc->file);
(void) getshort(doc->file); /* file time */
(void) getshort(doc->file); /* file date */