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

CRC/Inflater/Deflater/Adler32 methods that take a ByteBuffer throw UOE if backed by shared memory segment

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 25
    • 25
    • core-libs
    • None

      The methods in java.util.zip.{CRC,Inflater,Deflater,Alder32} that accept a ByteBuffer need to be update to deal with a ByteBuffer that is backed by a MemorySegment in a shared arena, e.g. the following throws UOE:

              var crc = new CRC32();
              try (var arena = Arena.ofShared()) {
                  ByteBuffer bb = arena.allocate(100).asByteBuffer();
                  crc.update(bb);
              }

      In implementation terms, the use of ((DirectBuffer)buffer).address() in these classes need to change to use NIO_ACCESS.getBufferAdress().

            pminborg Per-Ake Minborg
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: