Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-5915

bson_t larger than half maximum size can't be allocated

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.0.0, 1.30.2
    • Affects Version/s: None
    • Component/s: None
    • None
    • Needed
    • None
    • Fully Compatible
    • C Drivers
    • Completed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            micah.scott@mongodb.com Micah Scott
            Reporter:
            micah.scott@mongodb.com Micah Scott
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None