[foreign-memaccess+abi] Integrated: 8268230: Foreign Linker API & Windows user32/kernel32: String conversion seems broken

Jorn Vernee jvernee at openjdk.java.net
Tue Jun 15 18:42:55 UTC 2021


On Thu, 10 Jun 2021 12:03:59 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> The problem is that we only add a single 0 byte as a null terminator, regardless of the charset used. For wider char sets, more 0 bytes need to be added. For instance, for UTF_16LE two 0 bytes need to be added.
> 
> This patch fixes the issue by adding the null terminator to the Java string, and only then encoding it as a `byte[]`.

This pull request has now been integrated.

Changeset: 782aeb49
Author:    Jorn Vernee <jvernee at openjdk.org>
URL:       https://git.openjdk.java.net/panama-foreign/commit/782aeb49a5114fa64d729b1ad06271d70b82e698
Stats:     174 lines in 5 files changed: 65 ins; 99 del; 10 mod

8268230: Foreign Linker API & Windows user32/kernel32: String conversion seems broken

Reviewed-by: mcimadamore

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

PR: https://git.openjdk.java.net/panama-foreign/pull/554


More information about the panama-dev mailing list