[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 13:14:16 GMT, Per Minborg <duke at openjdk.org> wrote:

>> This PR prevents `StringCharBuffer` arguments in `MemorySegment::ofBuffer`.
>
> 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.

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

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


More information about the panama-dev mailing list