All bson_t append operations fail if the resulting size is larger than 0x40000000. The allocation size is always rounded up to a power of two, and the next power of two 0x80000000 would be larger than the max bson size, so allocation fails. This makes it impossible to test the true edge cases for allocation size.
An additional bug in test_bson_reserve_buffer_errors is hidden by the allocation bug. That test requires allocation failure in a case that in fact matches the maximum size exactly. It only fails currently due to the internal round-up to 0x80000000.
- blocks
-
CDRIVER-5641 BSON Binary Vector Subtype Support
-
- Closed
-
- causes
-
PHPC-2528 Investigate changes in CDRIVER-5915: bson_t larger than half maximum size can't be allocated
-
- Closed
-