summaryrefslogtreecommitdiff
path: root/source/cbz
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/cbz
parentbb57cfd5bebf922ad1f41c1a769eef39e4389ff6 (diff)
downloadmupdf-a384d20ff9ea220635b6c38282b73d7c33af944a.tar.xz
Error out on unsupported encrypted zip files
Diffstat (limited to 'source/cbz')
-rw-r--r--source/cbz/mucbz.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/cbz/mucbz.c b/source/cbz/mucbz.c
index dc36e0be..d0264c28 100644
--- a/source/cbz/mucbz.c
+++ b/source/cbz/mucbz.c
@@ -8,6 +8,8 @@
#define ZIP_CENTRAL_DIRECTORY_SIG 0x02014b50
#define ZIP_END_OF_CENTRAL_DIRECTORY_SIG 0x06054b50
+#define ZIP_ENCRYPTED_FLAG 0x1
+
#define DPI 72.0f
static void cbz_init_document(cbz_document *doc);
@@ -76,7 +78,7 @@ cbz_read_zip_entry(cbz_document *doc, int offset, int *sizep)
{
fz_context *ctx = doc->ctx;
fz_stream *file = doc->file;
- int sig, method, namelength, extralength;
+ int sig, general, method, namelength, extralength;
unsigned long csize, usize;
unsigned char *cdata;
int code;
@@ -88,7 +90,10 @@ cbz_read_zip_entry(cbz_document *doc, int offset, int *sizep)
fz_throw(ctx, FZ_ERROR_GENERIC, "wrong zip local file signature (0x%x)", sig);
(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 */