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

Incorrect string interning

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 13
    • 13
    • hotspot
    • b22
    • Verified

      In JDK-8223657 one of the calls to intern strings was updated incorrectly:

      --- a/src/hotspot/share/jvmci/compilerRuntime.cpp Tue May 14 11:28:44 2019 -0400
      +++ b/src/hotspot/share/jvmci/compilerRuntime.cpp Tue May 14 11:29:18 2019 -0400
      @@ -45,8 +45,7 @@
             // First 2 bytes of name contains length (number of bytes).
             int len = Bytes::get_Java_u2((address)name);
             name += 2;
      - TempNewSymbol sym = SymbolTable::new_symbol(name, len, CHECK);
      - str = StringTable::intern(sym, CHECK);
      + str = StringTable::intern(name, CHECK);
             assert(java_lang_String::is_instance(str), "must be string");
             *(oop*)string_result = str; // Store result
           }
      @@ -78,7 +77,7 @@
           name++;
           len -= 2;
         }

      The old code uses the u2 constant to specify the length of the name. The new code will use UTF8::unicode_length(utf8_string); (in StringTable::intern) to calculate the length. However, the string is not NUL terminated.

            coleenp Coleen Phillimore
            mikael Mikael Vidstedt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: