SERVER-130965ClosedFixed

Handle unsigned overflow in FLE2 binary search

In {{binarySearchCommon()}} at [src/mongo/crypto/fle_crypto.cpp|https://github.com/10gen/mongo/blob/85387fec361fa96d0ef9ba7efb3fcf4e86d068a1/src/mongo/crypto/fle_crypto.cpp#L2293], the variable rho (uint64_t) is doubled via rho = 2 * rho inside a galloping loop with no overflow guard.  If this continuous doubling eventually becomes 0, the {{ceil(log2(rho))}} would return -inf and converting that to uint64_t is undefined behavior.

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix
9.1.0-rc09.1.0-rc1025
Components
Server components related to this issue
Queryable Encryption
Labels
Tags and classification
bkp