RFR: 8281384: Random chars on paste from Windows clipboard [v2]

Kevin Rushforth kcr at openjdk.org
Wed Feb 26 13:25:07 UTC 2025


On Tue, 25 Feb 2025 15:24:39 GMT, Oliver Schmidtmer <oschmidtmer at openjdk.org> wrote:

>> Windows programs may reuse a clipboard buffer that is larger than the new content. In this case de NUL terminator is not at the end of the buffer, but within it. 
>> The current implementation copys the whole buffer into a text field, including the NUL terminator and the remaining chars.
>> 
>> The JIRA ticket contains a JNA based sample program, which prefills the buffer for demonstrating this issue.
>> If this should be added as a unit test, I'm open for advice how to do that.
>
> Oliver Schmidtmer has updated the pull request incrementally with one additional commit since the last revision:
> 
>   check both UTF16 bytes

@Schmidor I can't reproduce the original bug on Windows 11. Back when I did reproduce it, I was running Windows 10, so Microsoft might have fixed something on their end. I'll try to find a Windows 10 system to verify the fix on, but it looks like a good fix nonetheless.

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

PR Comment: https://git.openjdk.org/jfx/pull/1724#issuecomment-2684945424


More information about the openjfx-dev mailing list