From 92aa992ee35fe0632a8494312e29934d6e48fb02 Mon Sep 17 00:00:00 2001 From: Pradeep Gangatharan Date: Fri, 8 Dec 2023 09:45:32 +0530 Subject: [PATCH] reserve vector size --- .../SecureContent101/NMR_ModelReaderNode_KeyStoreCEKParams.cpp | 3 +++ .../NMR_ModelReaderNode_KeyStoreCipherValue.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCEKParams.cpp b/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCEKParams.cpp index 94df996ae..862d6da20 100644 --- a/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCEKParams.cpp +++ b/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCEKParams.cpp @@ -113,18 +113,21 @@ namespace NMR { PModelReaderNode_StringValue pXMLNode = std::make_shared(m_pWarnings); pXMLNode->parseXML(pXMLReader); std::string result = base64_decode(pXMLNode->getValue()); + m_iv.reserve(result.size()); if(!result.empty()) m_iv.insert(m_iv.begin(), result.begin(), result.end()); } else if (strcmp(pChildName, XML_3MF_SECURE_CONTENT_TAG) == 0) { PModelReaderNode_StringValue pXMLNode = std::make_shared(m_pWarnings); pXMLNode->parseXML(pXMLReader); std::string result = base64_decode(pXMLNode->getValue()); + m_tag.reserve(result.size()); if (!result.empty()) m_tag.insert(m_tag.begin(), result.begin(), result.end()); } else if (strcmp(pChildName, XML_3MF_SECURE_CONTENT_AAD) == 0) { PModelReaderNode_StringValue pXMLNode = std::make_shared(m_pWarnings); pXMLNode->parseXML(pXMLReader); std::string result = base64_decode(pXMLNode->getValue()); + m_aad.reserve(result.size()); if (!result.empty()) m_aad.insert(m_aad.begin(), result.begin(), result.end()); } else { diff --git a/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCipherValue.cpp b/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCipherValue.cpp index fd2e19ff1..5a82e690a 100644 --- a/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCipherValue.cpp +++ b/Source/Model/Reader/SecureContent101/NMR_ModelReaderNode_KeyStoreCipherValue.cpp @@ -73,6 +73,7 @@ namespace NMR { pNode->parseXML(pXMLReader); try { std::string result = base64_decode(pNode->getValue()); + m_sCipherValue.reserve(result.size()); if(!result.empty()) m_sCipherValue.insert(m_sCipherValue.begin(), result.begin(), result.end()); }