ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • 3.13.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • 0.4
    • Fully Compatible
    • Dotnet Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      BsonBinarySubType is an int-backed enum with no range check, so a value like 260 is accepted byBsonBinaryData and by JsonReader (BinData(), HexData(), legacy $type), then truncated to its low byte by WriteBinarySubType. The result is a stored binary value whose subtype byte does not match its contents: unreadable documents, silent 4-byte truncation, or a subtype that bypasses application-level checks.

      Fixes:

      • BsonBinaryData constructor rejects a subtype outside 0-255.
      • JsonReader rejects it with FormatException in all forms (BinData, HexData, legacy $type).
      • WriteBinarySubType throws instead of masking.
      • JsonWriter no longer emits a subType its own reader rejects.

       

      This is on both 3.x and 2.x

            Assignee:
            Ferdinando Papale
            Reporter:
            Ferdinando Papale
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: