ByteBuffer#put_cstring truncates symbols at first null byte

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • bson-4.6.0
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Symbols in Ruby can include null bytes, but put_cstring assumes the symbols can be converted to null terminated strings. As a result, serializing a symbol using this method when the symbol contains null bytes truncates the data.

      The proposed fix, to avoid behavior changes, is to raise ArgumentError when the symbol contains null bytes.

            Assignee:
            Oleg Pudeyev (Inactive)
            Reporter:
            Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: