From afef491c2f4651d84315bbaf41daa750854f6fe5 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Tue, 29 Mar 2016 15:22:02 +0200 Subject: 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. --- source/pdf/pdf-crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/pdf/pdf-crypt.c') 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); -- cgit v1.2.3