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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 12
    • 11
    • hotspot
    • b06

      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();
      }

            hseigel Harold Seigel (Inactive)
            hseigel Harold Seigel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: