diff -Nru cmake-3.22.1/debian/changelog cmake-3.22.1/debian/changelog --- cmake-3.22.1/debian/changelog 2022-08-17 10:44:06.000000000 +0000 +++ cmake-3.22.1/debian/changelog 2024-02-03 23:33:56.000000000 +0000 @@ -1,3 +1,13 @@ +cmake (3.22.1-1ubuntu1.22.04.2) jammy; urgency=medium + + * Cherry pick upstream fix to avoid a segfault when encountering + an empty /proc/cpuinfo (LP: #2052360). + * Cherry pick upstream fix for test failure caused by git setting + protocol.file.allow=user by default to mitigate CVE-2022-39253 + (LP: #2052362). + + -- dann frazier Sat, 03 Feb 2024 16:33:56 -0700 + cmake (3.22.1-1ubuntu1.22.04.1) jammy; urgency=medium * Cherry pick upstream change to fix FindGTest for Gmock (LP: #1986665) diff -Nru cmake-3.22.1/debian/patches/0001-Tests-Explicitly-allow-usage-of-git-file-based-proto.patch cmake-3.22.1/debian/patches/0001-Tests-Explicitly-allow-usage-of-git-file-based-proto.patch --- cmake-3.22.1/debian/patches/0001-Tests-Explicitly-allow-usage-of-git-file-based-proto.patch 1970-01-01 00:00:00.000000000 +0000 +++ cmake-3.22.1/debian/patches/0001-Tests-Explicitly-allow-usage-of-git-file-based-proto.patch 2024-02-03 23:33:56.000000000 +0000 @@ -0,0 +1,40 @@ +From 79ce0f434e916684d734e136b92e14f472a9d14a Mon Sep 17 00:00:00 2001 +From: Brad King +Date: Thu, 20 Oct 2022 13:38:20 -0400 +Subject: [PATCH] Tests: Explicitly allow usage of git file-based protocol in + test cases + +Due to CVE-2022-39253, Git 2.30.6 sets `protocol.file.allow=user` by +default. The change has also been backported to other Git versions by +distros. This breaks some of our test cases that use the file-based +protocol locally to simulate real workflows without requiring network +access. In these cases the file protocol is safe, so explicitly enable +it in the tests. +--- + Tests/CMakeLists.txt | 2 ++ + 1 file changed, 2 insertions(+) + +Origin: https://gitlab.kitware.com/cmake/cmake/-/commit/79ce0f434e916684d734e136b92e14f472a9d14a +Bug-Ubuntu: https://launchpad.net/bugs/2052362 +Last-Updated: 2024-02-03 + +Index: cmake-3.22.1/Tests/CMakeLists.txt +=================================================================== +--- cmake-3.22.1.orig/Tests/CMakeLists.txt ++++ cmake-3.22.1/Tests/CMakeLists.txt +@@ -1585,6 +1585,7 @@ if(BUILD_TESTING) + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProject") + set_tests_properties(ExternalProject PROPERTIES ++ ENVIRONMENT GIT_ALLOW_PROTOCOL=file + RUN_SERIAL 1 + TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) + +@@ -2779,6 +2780,7 @@ if(BUILD_TESTING) + -P "${CMake_BINARY_DIR}/Tests/CTestUpdateGIT.cmake" + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${CTestUpdateGIT_DIR}") ++ set_property(TEST CTest.UpdateGIT PROPERTY ENVIRONMENT GIT_ALLOW_PROTOCOL=file) + endif() + + # Test CTest Update with HG diff -Nru cmake-3.22.1/debian/patches/0002-Tolerate-empty-proc-cpuinfo.patch cmake-3.22.1/debian/patches/0002-Tolerate-empty-proc-cpuinfo.patch --- cmake-3.22.1/debian/patches/0002-Tolerate-empty-proc-cpuinfo.patch 1970-01-01 00:00:00.000000000 +0000 +++ cmake-3.22.1/debian/patches/0002-Tolerate-empty-proc-cpuinfo.patch 2024-02-03 23:33:56.000000000 +0000 @@ -0,0 +1,30 @@ +From: =?utf-8?q?Timo_R=C3=B6hling?= +Date: Sun, 28 May 2023 12:02:38 +0200 +Subject: Tolerate empty /proc/cpuinfo + +Forwarded: https://gitlab.kitware.com/utils/kwsys/-/merge_requests/284 + https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8504 +--- + Source/kwsys/SystemInformation.cxx | 4 ++++ + 1 file changed, 4 insertions(+) + +Origin: https://salsa.debian.org/cmake-team/cmake/-/blob/debian/3.26.4-4/debian/patches/0002-Tolerate-empty-proc-cpuinfo.patch?ref_type=tags +Bug: https://gitlab.kitware.com/cmake/cmake/-/issues/24937 +Bug-Ubuntu: https://launchpad.net/bugs/2052360 +Last-Updated: 2024-02-03 + +Index: cmake-3.22.1/Source/kwsys/SystemInformation.cxx +=================================================================== +--- cmake-3.22.1.orig/Source/kwsys/SystemInformation.cxx ++++ cmake-3.22.1/Source/kwsys/SystemInformation.cxx +@@ -3445,6 +3445,10 @@ bool SystemInformationImplementation::Re + fileSize++; + } + fclose(fd); ++ if (fileSize < 2) { ++ std::cout << "No data in /proc/cpuinfo" << std::endl; ++ return false; ++ } + buffer.resize(fileSize - 2); + // Number of logical CPUs (combination of multiple processors, multi-core + // and SMT) diff -Nru cmake-3.22.1/debian/patches/series cmake-3.22.1/debian/patches/series --- cmake-3.22.1/debian/patches/series 2022-08-17 10:44:06.000000000 +0000 +++ cmake-3.22.1/debian/patches/series 2024-02-03 23:22:20.000000000 +0000 @@ -2,3 +2,5 @@ 0002-Fix-check_symbol_exists-with-pedantic-errors.patch riscv64-atomic.patch backport-gmock-and-gmock-main-definitions.patch +0002-Tolerate-empty-proc-cpuinfo.patch +0001-Tests-Explicitly-allow-usage-of-git-file-based-proto.patch