diff --git a/src/VcpkgPortOverlay/CreatePortOverlay.ps1 b/src/VcpkgPortOverlay/CreatePortOverlay.ps1 index 4b0685c050..5acc4b48fd 100644 --- a/src/VcpkgPortOverlay/CreatePortOverlay.ps1 +++ b/src/VcpkgPortOverlay/CreatePortOverlay.ps1 @@ -561,6 +561,8 @@ if ($StampFile) { try { New-PortOverlay cpprestsdk -Version 2.10.18 -PortVersion 4 + # stdext::checked_array_iterator was removed in VS2026 (MSVC 19.43); replace with plain pointers. + Add-LocalPatch cpprestsdk 'fix-msvc-checked-array-iterator.patch' Add-LocalPatch cpprestsdk 'add-server-certificate-validation.patch' New-PortOverlay detours -Version 4.0.1 -PortVersion 8 diff --git a/src/VcpkgPortOverlay/README.md b/src/VcpkgPortOverlay/README.md index 6067b54151..8a97943dba 100644 --- a/src/VcpkgPortOverlay/README.md +++ b/src/VcpkgPortOverlay/README.md @@ -11,6 +11,8 @@ We add support for certificate pinning. Note that we use v2.10.18, which is not the latest. Changes: +* Add patch file: `fix-msvc-checked-array-iterator.patch` + * `stdext::checked_array_iterator` was removed in VS2026 (MSVC 19.43). This patch replaces its usages with plain pointers, which is equivalent since the `#else` branch already used plain pointers. * Add patch file: `add-server-certificate-validation.patch` * Patch source: https://github.com/microsoft/winget-cli/commit/888b4ed8f4f7d25cb05a47210e083fe29348163b diff --git a/src/VcpkgPortOverlay/patches/cpprestsdk/fix-msvc-checked-array-iterator.patch b/src/VcpkgPortOverlay/patches/cpprestsdk/fix-msvc-checked-array-iterator.patch new file mode 100644 index 0000000000..1a3b321302 --- /dev/null +++ b/src/VcpkgPortOverlay/patches/cpprestsdk/fix-msvc-checked-array-iterator.patch @@ -0,0 +1,57 @@ +diff --git a/Release/include/cpprest/containerstream.h b/Release/include/cpprest/containerstream.h +index b3028e84b..f59fcb65d 100644 +--- a/Release/include/cpprest/containerstream.h ++++ b/Release/include/cpprest/containerstream.h +@@ -401,7 +401,7 @@ class basic_container_buffer : public basic_streambuf<_CharType> + + #if defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL != 0 + // Avoid warning C4996: Use checked iterators under SECURE_SCL +- std::copy(readBegin, readEnd, stdext::checked_array_iterator<_CharType*>(ptr, count)); ++ std::copy(readBegin, readEnd, ptr); + #else + std::copy(readBegin, readEnd, ptr); + #endif // _WIN32 +diff --git a/Release/include/cpprest/producerconsumerstream.h b/Release/include/cpprest/producerconsumerstream.h +index c733651af..95fceea9a 100644 +--- a/Release/include/cpprest/producerconsumerstream.h ++++ b/Release/include/cpprest/producerconsumerstream.h +@@ -441,7 +441,7 @@ class basic_producer_consumer_buffer : public basic_streambuf<_CharType> + + #if defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL != 0 + // Avoid warning C4996: Use checked iterators under SECURE_SCL +- std::copy(beg, end, stdext::checked_array_iterator<_CharType*>(dest, count)); ++ std::copy(beg, end, dest); + #else + std::copy(beg, end, dest); + #endif // _WIN32 +@@ -464,7 +464,7 @@ class basic_producer_consumer_buffer : public basic_streambuf<_CharType> + + #if defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL != 0 + // Avoid warning C4996: Use checked iterators under SECURE_SCL +- std::copy(src, srcEnd, stdext::checked_array_iterator<_CharType*>(wbegin(), static_cast(avail))); ++ std::copy(src, srcEnd, wbegin()); + #else + std::copy(src, srcEnd, wbegin()); + #endif // _WIN32 +diff --git a/Release/include/cpprest/rawptrstream.h b/Release/include/cpprest/rawptrstream.h +index 14c0fd538..6af8fd17e 100644 +--- a/Release/include/cpprest/rawptrstream.h ++++ b/Release/include/cpprest/rawptrstream.h +@@ -441,7 +441,7 @@ class basic_rawptr_buffer : public basic_streambuf<_CharType> + + #if defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL != 0 + // Avoid warning C4996: Use checked iterators under SECURE_SCL +- std::copy(readBegin, readEnd, stdext::checked_array_iterator<_CharType*>(ptr, count)); ++ std::copy(readBegin, readEnd, ptr); + #else + std::copy(readBegin, readEnd, ptr); + #endif // _WIN32 +@@ -468,7 +468,7 @@ class basic_rawptr_buffer : public basic_streambuf<_CharType> + // Copy the data + #if defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL != 0 + // Avoid warning C4996: Use checked iterators under SECURE_SCL +- std::copy(ptr, ptr + count, stdext::checked_array_iterator<_CharType*>(m_data, m_size, m_current_position)); ++ std::copy(ptr, ptr + count, m_data + m_current_position); + #else + std::copy(ptr, ptr + count, m_data + m_current_position); + #endif // _WIN32