mirror of
https://git.yoctoproject.org/git/poky
synced 2026-01-01 13:58:04 +00:00
cmake: fix CVE-2025-9301
Reference:
https://nvd.nist.gov/vuln/detail/CVE-2025-9301
https://gitlab.kitware.com/cmake/cmake/-/issues/27135
Upstream-patch:
37e27f71bc
(From OE-Core rev: 0aacc4298f2cdaaf6d19a58e6e134b6a6ecc5097)
Signed-off-by: Saravanan <saravanan.kadambathursubramaniyam@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
parent
41ae63737b
commit
2b691e84d8
71
meta/recipes-devtools/cmake/cmake/CVE-2025-9301.patch
Normal file
71
meta/recipes-devtools/cmake/cmake/CVE-2025-9301.patch
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
From 37e27f71bc356d880c908040cd0cb68fa2c371b8 Mon Sep 17 00:00:00 2001
|
||||
From: Tyler Yankee <tyler.yankee@kitware.com>
|
||||
Date: Wed, 13 Aug 2025 15:22:28 -0400
|
||||
Subject: [PATCH] foreach: Explicitly skip replay without iterations
|
||||
|
||||
As written, foreach loops with a trailing `IN` (i.e., no loop
|
||||
variable(s) given) lead to an assertion error. Handle this case by
|
||||
exiting early when we know the loop won't execute anything.
|
||||
|
||||
Fixes: #27135
|
||||
|
||||
CVE: CVE-2025-9301
|
||||
|
||||
Upstream-Status: Backport
|
||||
https://gitlab.kitware.com/cmake/cmake/-/commit/37e27f71bc356d880c908040cd0cb68fa2c371b8
|
||||
|
||||
Signed-off-by: Tyler Yankee <tyler.yankee@kitware.com>
|
||||
Signed-off-by: Saravanan <saravanan.kadambathursubramaniyam@windriver.com>
|
||||
---
|
||||
Source/cmForEachCommand.cxx | 3 +++
|
||||
Tests/RunCMake/foreach/RunCMakeTest.cmake | 1 +
|
||||
Tests/RunCMake/foreach/TrailingIn-result.txt | 1 +
|
||||
Tests/RunCMake/foreach/TrailingIn.cmake | 5 +++++
|
||||
4 files changed, 10 insertions(+)
|
||||
create mode 100644 Tests/RunCMake/foreach/TrailingIn-result.txt
|
||||
create mode 100644 Tests/RunCMake/foreach/TrailingIn.cmake
|
||||
|
||||
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
|
||||
index dcb36265..35b59960 100644
|
||||
--- a/Source/cmForEachCommand.cxx
|
||||
+++ b/Source/cmForEachCommand.cxx
|
||||
@@ -100,6 +100,9 @@ bool cmForEachFunctionBlocker::ArgumentsMatch(cmListFileFunction const& lff,
|
||||
bool cmForEachFunctionBlocker::Replay(
|
||||
std::vector<cmListFileFunction> functions, cmExecutionStatus& inStatus)
|
||||
{
|
||||
+ if (this->Args.size() == this->IterationVarsCount) {
|
||||
+ return true;
|
||||
+ }
|
||||
return this->ZipLists ? this->ReplayZipLists(functions, inStatus)
|
||||
: this->ReplayItems(functions, inStatus);
|
||||
}
|
||||
diff --git a/Tests/RunCMake/foreach/RunCMakeTest.cmake b/Tests/RunCMake/foreach/RunCMakeTest.cmake
|
||||
index 15ca4770..acfc742e 100644
|
||||
--- a/Tests/RunCMake/foreach/RunCMakeTest.cmake
|
||||
+++ b/Tests/RunCMake/foreach/RunCMakeTest.cmake
|
||||
@@ -22,3 +22,4 @@ run_cmake(foreach-RANGE-invalid-test)
|
||||
run_cmake(foreach-RANGE-out-of-range-test)
|
||||
run_cmake(foreach-var-scope-CMP0124-OLD)
|
||||
run_cmake(foreach-var-scope-CMP0124-NEW)
|
||||
+run_cmake(TrailingIn)
|
||||
diff --git a/Tests/RunCMake/foreach/TrailingIn-result.txt b/Tests/RunCMake/foreach/TrailingIn-result.txt
|
||||
new file mode 100644
|
||||
index 00000000..573541ac
|
||||
--- /dev/null
|
||||
+++ b/Tests/RunCMake/foreach/TrailingIn-result.txt
|
||||
@@ -0,0 +1 @@
|
||||
+0
|
||||
diff --git a/Tests/RunCMake/foreach/TrailingIn.cmake b/Tests/RunCMake/foreach/TrailingIn.cmake
|
||||
new file mode 100644
|
||||
index 00000000..e2b5b2f2
|
||||
--- /dev/null
|
||||
+++ b/Tests/RunCMake/foreach/TrailingIn.cmake
|
||||
@@ -0,0 +1,5 @@
|
||||
+foreach(v IN)
|
||||
+endforeach()
|
||||
+
|
||||
+foreach(v1 v2 IN)
|
||||
+endforeach()
|
||||
--
|
||||
2.35.5
|
||||
|
||||
|
|
@ -12,6 +12,7 @@ SRC_URI:append:class-nativesdk = " \
|
|||
file://0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch \
|
||||
file://0001-ctest-Allow-arbitrary-characters-in-test-names-of-CT.patch \
|
||||
"
|
||||
SRC_URI += "file://CVE-2025-9301.patch"
|
||||
|
||||
LICENSE:append = " & BSD-1-Clause & MIT"
|
||||
LIC_FILES_CHKSUM:append = " \
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user