[foreign-memaccess+abi] RFR: 8294621: Copying from a StringCharBuffer-backed MemorySegment results in crash [v3]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Oct 14 20:31:17 UTC 2022


On Fri, 14 Oct 2022 19:11:40 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Nevermind, the array is not given away for read-only buffers... grrr
>
> We get the array in the code below. I guess we can check if it's `null` there?
> 
> i.e.
> 
> if (!buffer.isDirect()) {
>     // heap
>     if (base == null) throw ...;
>     // wrap
> }

yep - that works as `NIO_ACCESS.getBufferBase` goes straight to `Buffer.hb`, which is what we need.

-------------

PR: https://git.openjdk.org/panama-foreign/pull/741


More information about the panama-dev mailing list