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-767 Increase tag count field size to 32 bits for text search types #958

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

shreyaskalyan
Copy link
Collaborator

No description provided.

@shreyaskalyan
Copy link
Collaborator Author

shreyaskalyan commented Feb 18, 2025

I opted to make edge_count a 32 bit integer, rather than add a new field for text_edge_count, mostly because I think the branching looks better that way. I am open to going the other way and making a new variable though, I couldn't really decide which one was better.

@@ -196,14 +196,14 @@ static bool _mc_fle2_iev_v2_test_parse(_mc_fle2_iev_v2_test *test, bson_iter_t *
ASSERT_OR_PRINT_MSG(!test->substr_tag_count, "Duplicate field 'substr_tag_count'");
ASSERT(BSON_ITER_HOLDS_INT32(iter) || BSON_ITER_HOLDS_INT64(iter));
int64_t value = bson_iter_as_int64(iter);
ASSERT_OR_PRINT_MSG((value >= 0) && (value < 256), "Field 'substr_tag_count' must be 0..255");
test->substr_tag_count = (uint8_t)value;
ASSERT_OR_PRINT_MSG((value >= 0) && (value < UINT32_MAX), "Field 'substr_tag_count' must be 0..2^32-1");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a positive test with counts larger than 8-bit? You can generate one by printing the result of _mc_fle2_iev_v2_test_serialize_payload on a _mc_fle2_iev_v2_test object constructed from a JSON file without a payload field. The metadata fields can just be duplicated as many times as you need; we don't do checks beyond validity on them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -624,13 +636,13 @@ static inline uint32_t mc_FLE2IndexedEncryptedValueV2_serialized_length(const mc
// fle_blob_subtype: 1 byte
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? I still see uint8_t on line 619.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants