CDRIVER-5641: Fixes for packed_bit edge cases on systems with 32-bit size_t #1904
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes two problems that show up at runtime on 32-bit systems:
bson_vector_packed_bit_binary_data_length
would overflow while rounding nearly-maximum sizes up to the next complete byte.This intermediate calculation has been extended to 64 bits wide even on 32-bit size_t.
test_bson_vector_edge_cases_packed_bit
did not account for the size_t limit on maximum element count.Skipped tests for the real max_representable_elements value on 32-bit. Added new tests for the actual 32-bit edge cases.