Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8311814

C2: Uninitialized fields in BCEscapeAnalyzer::StateInfo

    XMLWordPrintable

Details

    Description

      SonarCloud reports multiple problems in BCEscapeAnalyzer::StateInfo. Most of the fields of this class are not initialized in constructor. The lifecycle for the state object is not clear, and we might accidentally use the garbage value from those fields.

      ```
      class BCEscapeAnalyzer::StateInfo {
      public:
        ArgumentMap *_vars; // <----
        ArgumentMap *_stack; // <----
        int _stack_height; // <----
        int _max_stack; // <----
        bool _initialized; // <----
        ArgumentMap empty_map;
      ```

      For extra safety, we need to initialize these to proper default values, and also provide proper getters/setters that assert we don't expose those default values before overwriting them.

      Attachments

        Activity

          People

            jcao Joshua Cao
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: