From 17c748e6b7ec0426344476efd2945eb7b5d6ca02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCnzli?= Date: Fri, 18 Jul 2014 15:44:56 +0200 Subject: properly decrypt strings in encrypted but broken documents If a PDF document is encrypted but broken, repairing caches all strings in encrypted form. Clearing the xref after repairing ensures that strings are returned to API callers as expected. Cf. https://code.google.com/p/sumatrapdf/issues/detail?id=2610 --- source/pdf/pdf-xref.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/pdf/pdf-xref.c') diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index b3505c36..d298a6c3 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -1169,6 +1169,10 @@ pdf_init_document(pdf_document *doc) pdf_drop_obj(dict); dict = NULL; } + + /* ensure that strings are not used in their repaired, non-decrypted form */ + if (doc->crypt) + pdf_clear_xref(doc); } } fz_catch(ctx) -- cgit v1.2.3