Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-50521

Dereference of null pointer in spatial_modify make_nodelist

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 7.1.0
    • 7.0.0, 7.0.1, 7.0.2
    • storage-engine, view-engine
    • None
    • Untriaged
    • 1
    • Unknown

    Description

      Flagged by clang-scan the following code sets r to null, not what r points to.

      static nodelist *make_nodelist(arena* a, size_t bufsize)
      {
          nodelist *r = (nodelist *) arena_alloc(a, sizeof(nodelist) + bufsize);
          if (r == nullptr) {
              return nullptr;
          }
          r = {};  <--- r is now null
          r->data.size = bufsize; <--- deref null
          r->data.buf = ((char *) r) + (sizeof(nodelist));
          return r;
      }
      

      Code should be

      *r = {};
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              jwalker Jim Walker
              jwalker Jim Walker
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty