Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1957

ByteBuffer#put_cstring truncates symbols at first null byte

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • bson-4.6.0
    • Affects Version/s: None
    • Component/s: BSON
    • Labels:
      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@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: