summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2016-03-29 15:22:02 +0200
committerSebastian Rasmussen <sebras@gmail.com>2016-03-29 15:23:30 +0200
commitafef491c2f4651d84315bbaf41daa750854f6fe5 (patch)
tree0e34a051bd4475f8fd8330edb1a103d1205164e0 /source
parent7f0c59655e837b337e652e48c36453a995e55960 (diff)
downloadmupdf-afef491c2f4651d84315bbaf41daa750854f6fe5.tar.xz
pdf-crypt: Crypt filer keys must be at least of length 40.
This is stated in table 3.22 in PDF Reference 1.7. Fixes valgrind errors for SIGABRT-090214-045131-116.pdf from bug 695040.
Diffstat (limited to 'source')
-rw-r--r--source/pdf/pdf-crypt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/pdf/pdf-crypt.c b/source/pdf/pdf-crypt.c
index a26f91a3..bdfdd672 100644
--- a/source/pdf/pdf-crypt.c
+++ b/source/pdf/pdf-crypt.c
@@ -332,7 +332,7 @@ pdf_parse_crypt_filter(fz_context *ctx, pdf_crypt_filter *cf, pdf_crypt *crypt,
fz_throw(ctx, FZ_ERROR_GENERIC, "invalid key length: %d", cf->length);
if ((crypt->r == 1 || crypt->r == 2 || crypt->r == 3 || crypt->r == 4) &&
- (cf->length < 0 || cf->length > 128))
+ (cf->length < 40 || cf->length > 128))
fz_throw(ctx, FZ_ERROR_GENERIC, "invalid key length: %d", cf->length);
if ((crypt->r == 5 || crypt->r == 6) && cf->length != 256)
fz_throw(ctx, FZ_ERROR_GENERIC, "invalid key length: %d", cf->length);