From 5d09fa8cde7ec76e7e65e8137081cf11d7d7cfc4 Mon Sep 17 00:00:00 2001 From: Denys Smirnov Date: Mon, 8 Oct 2018 18:35:33 +0300 Subject: [PATCH] crypt: handle length format violation for length=40 --- pdf/core/security/crypt/filter_v2.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdf/core/security/crypt/filter_v2.go b/pdf/core/security/crypt/filter_v2.go index e0a7100c..6f7f3f99 100644 --- a/pdf/core/security/crypt/filter_v2.go +++ b/pdf/core/security/crypt/filter_v2.go @@ -34,7 +34,7 @@ func newFilterV2(d FilterDict) (Filter, error) { // Standard security handler expresses the length in multiples of 8 (16 means 128) // We only deal with standard so far. (Public key not supported yet). if d.Length < 5 || d.Length > 16 { - if d.Length == 64 || d.Length == 128 { + if d.Length == 40 || d.Length == 64 || d.Length == 128 { common.Log.Debug("STANDARD VIOLATION: Crypt Length appears to be in bits rather than bytes - assuming bits (%d)", d.Length) d.Length /= 8 } else {