Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2072

Using a filter or projection with empty field names causes a crash when destroying cursor

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.5, 1.6.1
    • Affects Version/s: 1.5.1, 1.5.2
    • Component/s: None
    • None

      When running a query through

      mongoc_collection_find_with_opts

      where opts is invalid (i.e. "Cannot use empty keys in 'opts'."), a subsequent mongoc_cursor_destroy crashes, even though find_with_opts' documentation says I need to destroy the cursor.

      See the attached file, which I've compiled with

      gcc test.c -ggdb3 -o test536 $(pkg-config --cflags --libs libmongoc-1.0)

      When running it, it produces a segfault:

      derick@singlemalt:/tmp/536 $ ./test536 
      An error occurred: Cannot use empty keys in 'opts'.
      Segmentation fault
      

      I have also attached the backtrace.

        1. 536.gdb.txt
          3 kB
        2. test.c
          2 kB

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            derick Derick Rethans
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: