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

MemorySegment::asByteBuffer does not respect spatial bounds

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 16
    • 16, 17
    • core-libs
    • None
    • b32

    Backports

      Description

        The Javadoc of MemorySegment::asByteBuffer says:

        " The returned buffer's position (see Buffer.position() is initially set to zero, while the returned buffer's capacity and limit (see Buffer.capacity() and Buffer.limit(), respectively) are set to this segment' size (see byteSize()). For this reason, a byte buffer cannot be returned if this segment' size is greater than Integer.MAX_VALUE. "

        That said, while this contract is respected by native segment, it does not hold for heap segments, where the resulting buffer has always the size of the underlying array.

        Attachments

          Issue Links

            Activity

              People

                mcimadamore Maurizio Cimadamore
                mcimadamore Maurizio Cimadamore
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: