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

VarHandle and slice handle derived from layout are lacking alignment check

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 22
    • 21, 22
    • core-libs

        It was discovered that var handles and slice method handles derived from layouts through MemoryLayout::varHandle or MemoryLayout::sliceHandle or lacking the needed alignment checks.

        Only an alignment check for the final accessed value is done, but this means the access might not be aligned for the root layout. Take for instance this struct layout:

                MemoryLayout.structLayout(
                    JAVA_INT,
                    JAVA_SHORT.withName("x"));

        When the field "x" is accessed, we only check that the access is aligned according to the alignment constraint of the JAVA_SHORT, rather than the alignment constraint of the struct layout itself (which might be more strict).

        We should check that the access is aligned according to the alignment constraint of the root layout.

              jvernee Jorn Vernee
              jvernee Jorn Vernee
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: