diff --git a/.evergreen/config_generator/components/funcs/install_c_driver.py b/.evergreen/config_generator/components/funcs/install_c_driver.py index 29e886d159..fe81f5920e 100644 --- a/.evergreen/config_generator/components/funcs/install_c_driver.py +++ b/.evergreen/config_generator/components/funcs/install_c_driver.py @@ -14,7 +14,7 @@ # Only LIBMONGOC_DOWNLOAD_VERSION needs to be updated when pinning to an unreleased commit. # If pinning to an unreleased commit, create a "Blocked" JIRA ticket with # a "depends on" link to the appropriate C Driver version release ticket. -MONGOC_VERSION_MINIMUM = '1.30.1' +MONGOC_VERSION_MINIMUM = '57bffac11fde38d1ce097bb22fb5322a6114d644' # CXX-3103: bump to 2.0.0 once released. class InstallCDriver(Function): diff --git a/.evergreen/generated_configs/functions.yml b/.evergreen/generated_configs/functions.yml index c3448b6d91..783a6148bd 100644 --- a/.evergreen/generated_configs/functions.yml +++ b/.evergreen/generated_configs/functions.yml @@ -398,7 +398,7 @@ functions: type: setup params: updates: - - { key: mongoc_version_minimum, value: 1.30.1 } + - { key: mongoc_version_minimum, value: 57bffac11fde38d1ce097bb22fb5322a6114d644 } - command: subprocess.exec type: setup params: diff --git a/.evergreen/scripts/install-c-driver.sh b/.evergreen/scripts/install-c-driver.sh index 0a176e8594..073ffb88db 100755 --- a/.evergreen/scripts/install-c-driver.sh +++ b/.evergreen/scripts/install-c-driver.sh @@ -40,6 +40,9 @@ tar xzf mongo-c-driver.tar.gz --directory "${mongoc_dir}" --strip-components=1 # C Driver needs VERSION_CURRENT to compute BUILD_VERSION. if [[ -f "${mongoc_dir}/VERSION_CURRENT" ]]; then : # Use the existing VERSION_CURRENT bundled with the release tarball. + + # CXX-3103: overwrite incompatible build versions to support the upcoming 2.0.0 release. + echo "1.31.0-pre" >|"${mongoc_dir}/VERSION_CURRENT" else # RegEx pattern to match SemVer strings. See https://semver.org/. declare -r semver_regex="^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" diff --git a/CMakeLists.txt b/CMakeLists.txt index 88c466f985..63cf82378d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ set(LIBBSON_REQUIRED_ABI_VERSION 1.0) # Also update etc/purls.txt. set(LIBMONGOC_REQUIRED_VERSION 1.30.0) -set(LIBMONGOC_DOWNLOAD_VERSION 1.30.1) +set(LIBMONGOC_DOWNLOAD_VERSION 57bffac11fde38d1ce097bb22fb5322a6114d644) set(LIBMONGOC_REQUIRED_ABI_VERSION 1.0) set(NEED_DOWNLOAD_C_DRIVER false) diff --git a/examples/api/bsoncxx/examples/bson_errors/big_string.hh b/examples/api/bsoncxx/examples/bson_errors/big_string.hh index d8d14af18e..35d0eecd66 100644 --- a/examples/api/bsoncxx/examples/bson_errors/big_string.hh +++ b/examples/api/bsoncxx/examples/bson_errors/big_string.hh @@ -27,8 +27,7 @@ namespace examples { // Used to trigger builder append failure. struct big_string { // BSON_SIZE_MAX == 0x7FFFFFFF - // Leave some room for CDRIVER-5732. - std::size_t length{static_cast(std::numeric_limits::max() - 32u)}; + std::size_t length{static_cast(std::numeric_limits::max())}; // Allocate an UNINITIALIZED blob of data that will not be accessed due to length checks. // Leaving memory unitialized (rather than zero-init) should hopefully avoid slow and expensive diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/builder/core.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/builder/core.cpp index 1b06149488..3d7f070d76 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/builder/core.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/builder/core.cpp @@ -298,13 +298,14 @@ core& core::append(types::b_double const& value) { core& core::append(types::b_string const& value) { stdx::string_view key = _impl->next_key(); - - if (!bson_append_utf8( - _impl->back(), - key.data(), - static_cast(key.length()), - value.value.data(), - static_cast(value.value.length()))) { + std::size_t value_length = value.value.length(); + + if (value_length > std::size_t{INT32_MAX} || !bson_append_utf8( + _impl->back(), + key.data(), + static_cast(key.length()), + value.value.data(), + static_cast(value_length))) { throw bsoncxx::v_noabi::exception{error_code::k_cannot_append_string}; }