From 95b44619614bc98566c64057bb8372fdc3c2bbbd Mon Sep 17 00:00:00 2001 From: Svetlana Kulikova Date: Tue, 10 Feb 2026 11:15:48 +0300 Subject: [PATCH] Fix bug 79937 --- PdfFile/PdfEditor.cpp | 10 ++++++++-- PdfFile/test/test.cpp | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/PdfFile/PdfEditor.cpp b/PdfFile/PdfEditor.cpp index a6c58d8785..6a4cc6b5d1 100644 --- a/PdfFile/PdfEditor.cpp +++ b/PdfFile/PdfEditor.cpp @@ -1220,7 +1220,10 @@ bool CPdfEditor::IncrementalUpdates() pEncryptDict->SetRef(0, 0); pEncryptDict->Fix(); - pEncryptDict->SetPasswords(m_wsPassword, m_wsPassword); + std::wstring sPassword; + if (m_wsPassword) + sPassword = m_wsPassword; + pEncryptDict->SetPasswords(sPassword, sPassword); if (!pEncryptDict->UpdateKey(nCryptAlgorithm)) { pagesRefObj.free(); @@ -1538,7 +1541,10 @@ void CPdfEditor::Close() int nCryptAlgorithm = encAlgorithm; Object* pTrailerDict = xref->getTrailerDict(); - pDoc->SetPasswords(m_wsPassword, m_wsPassword); + std::wstring sPassword; + if (m_wsPassword) + sPassword = m_wsPassword; + pDoc->SetPasswords(sPassword, sPassword); PdfWriter::CEncryptDict* pEncryptDict = pDoc->GetEncrypt(); // Нужно получить словарь Encrypt БЕЗ дешифровки, поэтому времено отключаем encrypted в xref diff --git a/PdfFile/test/test.cpp b/PdfFile/test/test.cpp index 97e93bc238..cdfe2185a8 100644 --- a/PdfFile/test/test.cpp +++ b/PdfFile/test/test.cpp @@ -524,7 +524,7 @@ TEST_F(CPdfFileTest, EditPdf) TEST_F(CPdfFileTest, EditPdfFromBase64) { - GTEST_SKIP(); + //GTEST_SKIP(); NSFonts::NSApplicationFontStream::SetGlobalMemoryStorage(NSFonts::NSApplicationFontStream::CreateDefaultGlobalMemoryStorage()); @@ -602,7 +602,7 @@ TEST_F(CPdfFileTest, EditPdfFromBin) TEST_F(CPdfFileTest, EditPdfSign) { - //GTEST_SKIP(); + GTEST_SKIP(); LoadFromFile(); ASSERT_TRUE(pdfFile->EditPdf(wsDstFile));