Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-2630

Statically initialize Py_buffer to avoid false positives in Coverity

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 4.0
    • Affects Version/s: None
    • Component/s: None
    • None

      In _cbson_bson_to_dict and _cbson_decode_all we declare a Py_buffer like this:

      Py_buffer view;
      

      Coverity complains about this with: "var_decl: Declaring variable view without initializer."

      This is not a bug because we always initialize the buffer with PyObject_GetBuffer before attempting to use it however it still could be a good idea to initialize it to 0, like this:

      Py_buffer view = {0};
      

      This change could help remove these false positives in Coverity.

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: