From e28320baffed12eec547c701580aa9653430df48 Mon Sep 17 00:00:00 2001 From: Lauris Kaplinski Date: Fri, 10 Apr 2026 09:20:00 +0300 Subject: [PATCH 1/2] Do not try to insert empties into cont Lock --- cdoc/Lock.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cdoc/Lock.cpp b/cdoc/Lock.cpp index ce9f9079..5014d2fe 100644 --- a/cdoc/Lock.cpp +++ b/cdoc/Lock.cpp @@ -30,18 +30,23 @@ namespace libcdoc { std::string Lock::getString(Params key) const { - const std::vector& bytes = params.at(key); - return {(const char *) bytes.data(), bytes.size()}; + if (params.contains(key)) { + const std::vector& bytes = params.at(key); + return {(const char *) bytes.data(), bytes.size()}; + } + return {}; } int32_t Lock::getInt(Params key) const { - const std::vector& bytes = params.at(key); int32_t val = 0; - for (int i = 0; (i < bytes.size()) && (i < 4); i++) { - val = (val << 8) | bytes.at(i); - } + if (params.contains(key)) { + const std::vector& bytes = params.at(key); + for (int i = 0; (i < bytes.size()) && (i < 4); i++) { + val = (val << 8) | bytes.at(i); + } + } return val; } From d0c958d879cb7cae42e03b51136742503146f2c8 Mon Sep 17 00:00:00 2001 From: Lauris Kaplinski Date: Fri, 10 Apr 2026 23:48:45 +0300 Subject: [PATCH 2/2] Fixed Recipient verify --- cdoc/Recipient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdoc/Recipient.cpp b/cdoc/Recipient.cpp index 49e7f653..88cf579a 100644 --- a/cdoc/Recipient.cpp +++ b/cdoc/Recipient.cpp @@ -212,7 +212,7 @@ Recipient::validate() const switch(type) { case SYMMETRIC_KEY: // Either user-defined label or LABEL property is required - return !label.empty() || lbl_parts.contains("CDoc2::Label::LABEL"); + return !label.empty() || lbl_parts.contains(std::string(CDoc2::Label::LABEL)); case PUBLIC_KEY: // Public key should not be empty return !rcpt_key.empty();