[SERVER-70485] double indexMin defaults to lowest positive double Created: 11/Oct/22  Updated: 29/Oct/23  Resolved: 22/Nov/22

Status: Closed
Project: Core Server
Component/s: Queryable Encryption
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Kevin Albertson Assignee: Mark Benvenuto
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-69671 FLE2 range float precision: update cr... Closed
Problem/Incident
is caused by SERVER-70066 createCollection should not allow min... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Security 2022-10-31, Security 2022-11-28
Participants:

 Description   

Scope
Use std::numeric_limits<double>::lowest(), not std::numeric_limits<double>::min(), for the default index minimum value for double.

std::numeric_limits<double>::min() is used in the following locations:

Background & Motivation

SERVER-70066 applied changes to prohibit setting a custom minimum and maximum index value for double. std::numeric_limits<double>::min() returns the minimum positive normalized value.
The expected behavior is to use std::numeric_limits<double>::lowest(), the lowest negative value.

The index min/max has no impact on how double is encoded in getTypeInfoDouble. But it is applied to getMinCover when an infinite bound is specified:

https://github.com/mongodb/mongo/blob/d82601cca796acb046db331fd08ab222da7cb316/src/mongo/crypto/fle_crypto.cpp#L1499-L1504



 Comments   
Comment by Mark Benvenuto [ 22/Nov/22 ]

Fixed with https://github.com/mongodb/mongo/commit/0d67266b5759f89dbf63b72d4d1172c7a421a4a2

Comment by Kevin Albertson [ 10/Nov/22 ]

This may still be an open issue. std::numeric_limits<double>::min() is used in the following locations:

Those may need to be changed to std::numeric_limits<double>::lowest()

Generated at Thu Feb 08 06:16:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.