Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-293

Add checks for invalid handles to API calls

    • Type: Icon: Task Task
    • Resolution: Done
    • None
    • Affects Version/s: None
    • Component/s: None

      A change to one of the tests exposed that we dereference pointers in the session and connection handle without checking for validity.

      It's tempting to either add a NULL check or a WT_ASSERT checking for a NULL session to the include/api.h API_CALL macros.

      Adding the check didn't solve the particular test issue. The test (test_txn01) was doing:

      self.session.begin_transaction()
      cursor = self.session.open_cursor(self.uri, None)
      cursor.reset()
      session.commit_transaction()
      cursor.reset()

      The commit_transaction call frees the cursor structure (via __wt_cursor_close). The second cursor.reset call is operating on a freed pointer - thus the cursor.session field can't be accessed safely.

            Assignee:
            alexander.gorrod@mongodb.com Alexander Gorrod
            Reporter:
            alexander.gorrod@mongodb.com Alexander Gorrod
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: