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

[Panama] Copying from a StringCharBuffer-backed MemorySegment results in crash

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      Attempting to copy from a MemorySegment backed by a StringCharBuffer results in the JVM crashing, as both the buffer's 'address' field is 0 and the 'base' object (the 'hb' array) is null


      ---------- BEGIN SOURCE ----------
      import java.lang.foreign.MemorySegment;
      import java.nio.CharBuffer;

      public class Main {
        public static void main(String[] args) {
          MemorySegment src = MemorySegment.ofBuffer(CharBuffer.wrap("Hello"));
          MemorySegment dst = MemorySegment.ofArray(new char[5]);
          dst.copyFrom(src);
        }
      }

      ---------- END SOURCE ----------

      FREQUENCY : always


            pminborg Per-Ake Minborg
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: