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

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Oct 14 18:40:31 UTC 2022


On Fri, 14 Oct 2022 18:34:46 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update after comment
>
> src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 473:
> 
>> 471:         Objects.requireNonNull(bb);
>> 472:         // StringCharBuffer is packet-private
>> 473:         if ("java.nio.StringCharBuffer".equals(bb.getClass().getName())) {
> 
> IMHO would be better to call Buffer::isDirect, and then check if Buffer::array is == null.

Nevermind, the array is not given away for read-only buffers... grrr

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

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


More information about the panama-dev mailing list