Count Int32 and BSONSymbol in calculateObjectSize

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • bson-7.4.0
    • Affects Version/s: None
    • Component/s: BSON
    • 0
    • Not Needed
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Use Case

      As a... user of bson library
      I want... calculateObjectSize() to return the exact byte count
      So that... documents within the 16 MB limit are not incorrectly rejected client-side

      User Experience

      calculateObjectSize over-reports by 12 bytes per Int32 or BSONSymbol occurrence, causing valid documents to be rejected or buffers to be over-allocated

      Dependencies

      • None

      Risks/Unknowns

      • Low risk - no other types affected, no other branches (only size calculation)

      Acceptance Criteria

      Implementation Requirements

      • Add an Int32 branch in calculateElementSize returning the correct 4-byte size.
      • Fix the BSONSymbol type guard: 'Symbol' to 'BSONSymbol'.

      Testing Requirements

      • new unit tests

      Documentation Requirements

      • N/A

      Follow Up Requirements

      • N/A

            Assignee:
            Sergey Zelenov
            Reporter:
            TPM Jira Automations Bot
            Pavel Safronov, Sergey Zelenov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: