commit | 4411ca1cdecfe304a7db169bc828a3f4fc1e65f5 | [log] [tgz] |
---|---|---|
author | Lei Zhang <thestig@chromium.org> | Mon Jan 06 23:01:45 2020 +0000 |
committer | Lei Zhang <thestig@chromium.org> | Mon Jan 06 23:01:45 2020 +0000 |
tree | 43a490f0138d2fd3fc1068b334aa8b62d335ba43 | |
parent | 1077a87feff391cb8ad18ac40be8ef391bfca613 [diff] |
M80: Avoid regenerating revision 5 and 6 encryption dictionaries. Unlike revision 2 and 3, revision 5 and 6 encryption is not tied to the document ID in the trailer. Thus regenerating the encryption dictionary when the ID changes is completely unnecessary. Avoid doing this. Unlike https://pdfium-review.googlesource.com/c/pdfium/+/63933, this merge CL does not include the tests. Change-Id: I074a9b6e03bcaa39c8fb18eed6487454bdc5bcd1 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/63933 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> (cherry picked from commit aeecf1ab623450ec12aaeacd5fab476472124ee7) Bug: chromium:1032090 Change-Id: I16f5fb26c4abc3519a1042ef00a699919718f795 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/64673 Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp index 71ef379..f2e4e24 100644 --- a/core/fpdfapi/edit/cpdf_creator.cpp +++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -618,7 +618,9 @@ m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone()); if (m_pEncryptDict) { ASSERT(m_pParser); - if (m_pEncryptDict->GetStringFor("Filter") == "Standard") { + int revision = m_pEncryptDict->GetIntegerFor("R"); + if ((revision == 2 || revision == 3) && + m_pEncryptDict->GetStringFor("Filter") == "Standard") { m_pNewEncryptDict = ToDictionary(m_pEncryptDict->Clone()); m_pEncryptDict = m_pNewEncryptDict; m_pSecurityHandler = pdfium::MakeRetain<CPDF_SecurityHandler>();