Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MONGOCRYPT-702 FLE2 range floating point correctness issue when using precision mode #868

Merged
merged 11 commits into from
Jul 24, 2024
1 change: 1 addition & 0 deletions .evergreen/init.sh
erwee marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ run_ctest() {

run_python() {
pys=(
/Users/shreyaskal/dev/bin/python
py
python3.14
python3.13
Expand Down
13 changes: 11 additions & 2 deletions src/mc-range-encoding-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "mc-dec128.h"
#include "mc-optional-private.h"
#include "mongocrypt-status-private.h"
#include "mongocrypt.h"
erwee marked this conversation as resolved.
Show resolved Hide resolved

#include <mlib/int128.h>

Expand Down Expand Up @@ -87,7 +88,11 @@ typedef struct {
} mc_getTypeInfoDouble_args_t;

// `mc_canUsePrecisionModeDouble` returns true if the domain can be represented in fewer than 64 bits.
bool mc_canUsePrecisionModeDouble(double min, double max, uint32_t precision, uint32_t *maxBitsOut);
bool mc_canUsePrecisionModeDouble(double min,
double max,
uint32_t precision,
uint32_t *maxBitsOut,
mongocrypt_status_t *status);

/* mc_getTypeInfoDouble encodes the double `args.value` into an OSTType_Double
* `out`. Returns false and sets `status` on error. */
Expand All @@ -111,7 +116,11 @@ typedef struct {
} mc_getTypeInfoDecimal128_args_t;

// `mc_canUsePrecisionModeDecimal` returns true if the domain can be represented in fewer than 128 bits.
bool mc_canUsePrecisionModeDecimal(mc_dec128 min, mc_dec128 max, uint32_t precision, uint32_t *maxBitsOut);
bool mc_canUsePrecisionModeDecimal(mc_dec128 min,
mc_dec128 max,
uint32_t precision,
uint32_t *maxBitsOut,
mongocrypt_status_t *status);

/**
* @brief Obtain the OST encoding of a finite Decimal128 value.
Expand Down
Loading
Loading