SERVER-114927 Fix overflow (#44974)

GitOrigin-RevId: 2dda5a7d3ce9b689495c473e01c91417afc404d4
This commit is contained in:
Niels Lohmann 2025-12-17 22:23:26 +01:00 committed by MongoDB Bot
parent 29367986fc
commit 23dd776926

View File

@ -488,7 +488,8 @@ public:
// We intentionally set the batch size to the max size_t value for a batch size of 0 in
// order to simulate "no limit" on the batch size. We will run out of space in the
// buffer before we reach this limit anyway.
size_t batchSize = cmd.getBatchSize().value_or(std::numeric_limits<size_t>::max());
size_t batchSize = cmd.getBatchSize() ? static_cast<size_t>(*cmd.getBatchSize())
: std::numeric_limits<size_t>::max();
try {
return batchedExecute(