@@ -729,15 +729,17 @@ static bool _mongocrypt_fle2_placeholder_common(_mongocrypt_key_broker_t *kb,
729
729
}
730
730
731
731
static bool _fle2_choose_contention_factor (mongocrypt_t * crypt ,
732
- int64_t exclusive_upper_bound ,
732
+ int64_t maxContentionFactor ,
733
733
int64_t * out ,
734
734
mongocrypt_status_t * status ) {
735
+ BSON_ASSERT_PARAM (crypt );
736
+ BSON_ASSERT_PARAM (out );
735
737
if (crypt -> opts .contention_factor_fn ) {
736
- if (!crypt -> opts .contention_factor_fn (exclusive_upper_bound , out )) {
738
+ if (!crypt -> opts .contention_factor_fn (maxContentionFactor + 1 , out )) {
737
739
CLIENT_ERR ("contention_factor_fn failed" );
738
740
return false;
739
741
}
740
- if (* out < 0 || * out > exclusive_upper_bound ) {
742
+ if (* out < 0 || * out > maxContentionFactor ) {
741
743
CLIENT_ERR ("chosen contentionFactor out of range" );
742
744
return false;
743
745
}
@@ -771,7 +773,7 @@ static bool _mongocrypt_fle2_placeholder_to_insert_update_common(_mongocrypt_key
771
773
/* Choose a contentionFactor in the inclusive range [0,
772
774
* placeholder->maxContentionFactor] */
773
775
if (!_fle2_choose_contention_factor (kb -> crypt ,
774
- placeholder -> maxContentionFactor + 1 ,
776
+ placeholder -> maxContentionFactor ,
775
777
& out -> contentionFactor ,
776
778
status )) {
777
779
goto fail ;
@@ -1570,7 +1572,7 @@ static bool _mongocrypt_fle2_placeholder_to_insert_update_ciphertextForTextSearc
1570
1572
/* Choose a contentionFactor in the inclusive range [0,
1571
1573
* placeholder->maxContentionFactor] */
1572
1574
if (!_fle2_choose_contention_factor (kb -> crypt ,
1573
- placeholder -> maxContentionFactor + 1 ,
1575
+ placeholder -> maxContentionFactor ,
1574
1576
& payload .contentionFactor ,
1575
1577
status )) {
1576
1578
goto fail ;
0 commit comments