diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2012-03-01 22:51:49 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2012-03-06 16:10:22 +0100 |
commit | 126417304a0286c8998a5856b3fdae92357a785d (patch) | |
tree | dbc9c70e86e6b8ecd354389f2d220638d0d24d8f /pdf | |
parent | c5c6aa47e4fbc0323c36065a6f8acaaed609f852 (diff) | |
download | mupdf-126417304a0286c8998a5856b3fdae92357a785d.tar.xz |
Guess encryption revision from the version if missing.
Diffstat (limited to 'pdf')
-rw-r--r-- | pdf/pdf_crypt.c | 12 |
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"); |