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

BSON C-Extension: Remove attempted use of memory buffer after deallocation

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.9.0
    • Affects Version/s: None
    • Component/s: None
    • None

      In the legacy BSON C-extension, we're attempting to use a byte buffer in an error message to get the buffer's size after we've already deallocated it:

      if (length > bson_buffer_get_max_size(buffer)) {
          bson_buffer_free(buffer);
          rb_raise(InvalidDocument,
            "Document too large: This BSON document is limited to %d bytes.",
            bson_buffer_get_max_size(buffer));
          return;
      }
      

      Link:
      https://github.com/mongodb/mongo-ruby-driver/blob/master/ext/cbson/cbson.c#L603-L610

            Assignee:
            brandon.black@10gen.com Brandon Black
            Reporter:
            brandon.black@10gen.com Brandon Black
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: