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

Statically initialize Py_buffer to avoid false positives in Coverity

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Trivial - P5
    • Resolution: Fixed
    • None
    • 4.0
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: