Skip to content

Commit a9c5782

Browse files
committed
Disable curl examples and fix out-of-bounds access in retry loop
1 parent fd741eb commit a9c5782

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cmake/FindLibCURL.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ endif()
3535
# This is in function() so no need to backup the variables
3636
function(get_libcurl)
3737
set(BUILD_CURL_EXE OFF)
38+
set(BUILD_EXAMPLES OFF)
3839
set(BUILD_LIBCURL_DOCS OFF)
3940
set(BUILD_MISC_DOCS OFF)
4041
set(BUILD_SHARED_LIBS OFF)
42+
set(BUILD_TESTING OFF)
4143
set(CURL_ENABLE_EXPORT_TARGET OFF)
4244
set(CURL_USE_LIBSSH2 OFF)
4345
set(CURL_USE_LIBPSL OFF)

src/vcpkg/base/downloads.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,10 @@ namespace vcpkg
587587
using namespace std::chrono_literals;
588588
static constexpr std::array<std::chrono::seconds, 3> attempt_delays = {0s, 1s, 2s};
589589
DownloadPrognosis prognosis = DownloadPrognosis::NetworkErrorProxyMightHelp;
590-
for (size_t attempt_count = 0; attempt_count < attempt_delays.size() + 1; attempt_count++)
590+
for (size_t attempt_count = 0; attempt_count < attempt_delays.size(); attempt_count++)
591591
{
592+
std::this_thread::sleep_for(attempt_delays[attempt_count]);
593+
592594
prognosis = perform_download(context, machine_readable_progress, raw_url, download_path_part_path, headers);
593595

594596
if (DownloadPrognosis::Success == prognosis)
@@ -604,7 +606,6 @@ namespace vcpkg
604606

605607
context.report_error(msg::format(
606608
msgDownloadTransientErrorRetry, msg::count = attempt_count + 1, msg::value = attempt_delays.size()));
607-
std::this_thread::sleep_for(attempt_delays[attempt_count]);
608609
}
609610

610611
if (DownloadPrognosis::Success != prognosis)

0 commit comments

Comments
 (0)