From f1b4b2ac295b02197927c3028b4aa942be8f2455 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Mon, 17 Jul 2023 20:13:55 +0300 Subject: [PATCH] Fix NormalizePath method --- DesktopEditor/common/Path.cpp | 7 ++++++- DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp | 4 ++-- DesktopEditor/xmlsec/src/src/XmlRels.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/DesktopEditor/common/Path.cpp b/DesktopEditor/common/Path.cpp index 17a194f99a..118f41cbc4 100644 --- a/DesktopEditor/common/Path.cpp +++ b/DesktopEditor/common/Path.cpp @@ -124,10 +124,15 @@ namespace NSSystemPath int nCurrentW = 0; bool bIsUp = false; -#if !defined(_WIN32) && !defined (_WIN64) if (pData[nCurrent] == '/' || pData[nCurrent] == '\\') + { +#if !defined(_WIN32) && !defined (_WIN64) pDataNorm[nCurrentW++] = pData[nCurrent]; #endif + ++nCurrentSlash; + pSlashPoints[nCurrentSlash] = nCurrentW; + } + while (nCurrent < nLen) { if (pData[nCurrent] == '/' || pData[nCurrent] == '\\') diff --git a/DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp b/DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp index b3febeb83b..fcf1d05cdb 100644 --- a/DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp +++ b/DesktopEditor/xmlsec/src/src/OOXMLVerifier.cpp @@ -371,11 +371,11 @@ public: if (curRel.target_mode == L"Internal" && !CSignFolderFiles::CheckNeedSign(curRel.target)) continue; - std::wstring sFullPath = oInfo.GetHeadPath(curRel.target); - // если внутренний файл отсутствует - не валидная подпись if (curRel.target_mode == L"Internal") { + std::wstring sFullPath = oInfo.GetHeadPath(curRel.target); + if (!m_pFolder->exists(sFullPath)) m_valid = OOXML_SIGNATURE_INVALID; else diff --git a/DesktopEditor/xmlsec/src/src/XmlRels.h b/DesktopEditor/xmlsec/src/src/XmlRels.h index a578833971..fe2b2b512d 100644 --- a/DesktopEditor/xmlsec/src/src/XmlRels.h +++ b/DesktopEditor/xmlsec/src/src/XmlRels.h @@ -40,7 +40,7 @@ public: std::wstring GetHeadPath(const std::wstring& sFile) { std::wstring sFullPath = m_sAliasDirectory + L"/" + sFile; - NSSystemPath::NormalizePath(sFullPath); + sFullPath = NSSystemPath::NormalizePath(sFullPath); if (!sFullPath.empty() && '/' != sFullPath[0]) sFullPath = L"/" + sFullPath;