summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf/pdf_crypt.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/pdf/pdf_crypt.c b/pdf/pdf_crypt.c
index c99e696c..cbd495d2 100644
--- a/pdf/pdf_crypt.c
+++ b/pdf/pdf_crypt.c
@@ -158,10 +158,20 @@ pdf_new_crypt(fz_context *ctx, pdf_obj *dict, pdf_obj *id)
obj = pdf_dict_gets(dict, "R");
if (pdf_is_int(obj))
crypt->r = pdf_to_int(obj);
+ else if (crypt->v <= 4)
+ {
+ fz_warn(ctx, "encryption dictionary missing revision value, guessing...");
+ if (crypt->v < 2)
+ crypt->r = 2;
+ else if (crypt->v == 2 || crypt->v == 3)
+ crypt->r = 3;
+ else if (crypt->v == 4)
+ crypt->r = 4;
+ }
else
{
pdf_free_crypt(ctx, crypt);
- fz_throw(ctx, "encryption dictionary missing revision value");
+ fz_throw(ctx, "encryption dictionary missing version and revision value");
}
obj = pdf_dict_gets(dict, "O");