diff options
author | Artem Strygin <art-snake@yandex-team.ru> | 2018-07-24 10:14:24 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-24 10:14:24 +0000 |
commit | aa50728980036f07fda232cea974fd80c89b7cb7 (patch) | |
tree | 101e954b24a44f1d818923076695bd25759d6b14 /core/fpdfapi/edit/cpdf_creator.cpp | |
parent | c62aa207e9acb919c33df5f3694fe159619dda86 (diff) | |
download | pdfium-aa50728980036f07fda232cea974fd80c89b7cb7.tar.xz |
Fix encryption dictionary owning.
Return encryption dictionary as const reference
from CPDF_Parser.
Create a copy in CPDF_Creator if needed.
Change-Id: I270f71d307d818fba7f65ebe379f5942ae816934
Reviewed-on: https://pdfium-review.googlesource.com/38390
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Diffstat (limited to 'core/fpdfapi/edit/cpdf_creator.cpp')
-rw-r--r-- | core/fpdfapi/edit/cpdf_creator.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp index 5d4fac478d..aa8c751046 100644 --- a/core/fpdfapi/edit/cpdf_creator.cpp +++ b/core/fpdfapi/edit/cpdf_creator.cpp @@ -619,10 +619,11 @@ void CPDF_Creator::InitID() { if (m_pEncryptDict) { ASSERT(m_pParser); if (m_pEncryptDict->GetStringFor("Filter") == "Standard") { - ByteString user_pass = m_pParser->GetPassword(); + m_pNewEncryptDict = ToDictionary(m_pEncryptDict->Clone()); + m_pEncryptDict = m_pNewEncryptDict.get(); m_pSecurityHandler = pdfium::MakeUnique<CPDF_SecurityHandler>(); - m_pSecurityHandler->OnCreate(m_pEncryptDict.Get(), m_pIDArray.get(), - user_pass); + m_pSecurityHandler->OnCreate(m_pNewEncryptDict.get(), m_pIDArray.get(), + m_pParser->GetPassword()); m_bSecurityChanged = true; } } @@ -666,6 +667,7 @@ void CPDF_Creator::RemoveSecurity() { m_pSecurityHandler.Reset(); m_bSecurityChanged = true; m_pEncryptDict = nullptr; + m_pNewEncryptDict.reset(); } CPDF_CryptoHandler* CPDF_Creator::GetCryptoHandler() { |