spdlog: patch CVE-2025-6140

Pick commit [1] mentioned in [2] as listed in [3].

[1] 10320184df
[2] https://github.com/gabime/spdlog/issues/3360
[3] https://nvd.nist.gov/vuln/detail/CVE-2025-6140

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
Peter Marko 2025-07-12 14:56:56 +02:00 committed by Armin Kuster
parent ba84c52d55
commit 1fb0820868
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 10320184df1eb4638e253a34b1eb44ce78954094 Mon Sep 17 00:00:00 2001
From: Gabi Melman <gmelman1@gmail.com>
Date: Mon, 17 Mar 2025 15:46:31 +0200
Subject: [PATCH] Fixed issue #3360 (#3361)
CVE: CVE-2025-6140
Upstream-Status: Backport [https://github.com/gabime/spdlog/commit/10320184df1eb4638e253a34b1eb44ce78954094]
Signed-off-by: Peter Marko <peter.marko@siemens.com>
---
include/spdlog/pattern_formatter-inl.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/spdlog/pattern_formatter-inl.h b/include/spdlog/pattern_formatter-inl.h
index b53d8051..fd408ed5 100644
--- a/include/spdlog/pattern_formatter-inl.h
+++ b/include/spdlog/pattern_formatter-inl.h
@@ -65,6 +65,9 @@ public:
pad_it(remaining_pad_);
} else if (padinfo_.truncate_) {
long new_size = static_cast<long>(dest_.size()) + remaining_pad_;
+ if (new_size < 0) {
+ new_size = 0;
+ }
dest_.resize(static_cast<size_t>(new_size));
}
}
@@ -259,7 +262,7 @@ public:
: flag_formatter(padinfo) {}
void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override {
- const size_t field_size = 10;
+ const size_t field_size = 8;
ScopedPadder p(field_size, padinfo_, dest);
fmt_helper::pad2(tm_time.tm_mon + 1, dest);

View File

@ -4,7 +4,9 @@ LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=9573510928429ad0cbe5ba4de77546e9"
SRCREV = "7c02e204c92545f869e2f04edaab1f19fe8b19fd"
SRC_URI = "git://github.com/gabime/spdlog.git;protocol=https;branch=v1.x"
SRC_URI = "git://github.com/gabime/spdlog.git;protocol=https;branch=v1.x \
file://CVE-2025-6140.patch \
"
DEPENDS = "fmt"