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

Metadata::print_value_string() compares 'this' to NULL

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 11
    • Fix Version/s: 12
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b06

      Description

      The compiler is free to elide this test, since (this == NULL) can never be true; applying an ordinary member function to NULL invokes undefined behavior. This function needs to be changed.

      char* Metadata::print_value_string() const {
        char buf[256];
        stringStream st(buf, sizeof(buf));
        if (this == NULL) {
          st.print("NULL");
        } else {
          print_value_on(&st);
        }
        return st.as_string();
      }

        Attachments

          Activity

            People

            Assignee:
            hseigel Harold Seigel
            Reporter:
            hseigel Harold Seigel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: