MemorySegment::asByteBuffer does not respect spatial bounds

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 16
    • Affects Version/s: 16, 17
    • Component/s: core-libs
    • None
    • b32

        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.

              Assignee:
              Maurizio Cimadamore
              Reporter:
              Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: