Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-56350

Coverity analysis defect 119880: Uninitialized scalar field in OwnedValueAccessor

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 5.1.0-rc0
    • None
    • None
    • Fully Compatible
    • ALL
    • Query Execution 2021-06-14

    Description

      In OwnedValueAccessor, _val will be left uninitialized if the default constructor is used. It should probably have a default value of zero, as other classes in this file do so.

      /**
       * Accessor for a slot which can own the value held by that slot.
       */
      class OwnedValueAccessor final : public SlotAccessor {
      public:
          OwnedValueAccessor() = default;
       
      // omitted
       
      private:
          bool _owned{false};
          TypeTags _tag{TypeTags::Nothing};
          Value _val;  // <--------------
      };
      

      Uninitialized scalar field

      The field will contain an arbitrary value left over from earlier computations. A scalar field is not initialized by the constructor
      /src/mongo/db/exec/sbe/values/slot.h:199: UNINIT_CTOR 119880 The compiler-generated constructor for this class does not initialize "_val".

      Attachments

        Activity

          People

            sajed.nahian@mongodb.com Sajed Nahian
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: