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

Memory corruption in the implementation of the stack walk API

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 11, 13, 14
    • hotspot
    • 9

      The java/lang/StackFrameInfo class declares a field called 'bci' with type short.
      The support in the JVM to update this field incorrectly uses a method writing an int:

      void java_lang_StackFrameInfo::set_bci(oop element, int value) {
          element->int_field_put(_bci_offset, value);
      }

      The size of an int being 4 bytes, and the size of a short being 2 bytes, when this method is called, it overwrites the next two bytes after the bci field.

      Correct implementation of this method is:

      void java_lang_StackFrameInfo::set_bci(oop element, int value) {
          element->short_field_put(_bci_offset, value);
      }

            fparain Frederic Parain
            fparain Frederic Parain
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: