RFR: 8281384: Random chars on paste from Windows clipboard

Kevin Rushforth kcr at openjdk.org
Tue Feb 25 15:08:09 UTC 2025


On Tue, 25 Feb 2025 14:36:38 GMT, Kevin Rushforth <kcr 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.
>
> modules/javafx.graphics/src/main/java/com/sun/glass/ui/win/WinSystemClipboard.java line 255:
> 
>> 253:                 try {
>> 254:                     // JDK-8118474 - internal Windows data null terminated
>> 255:                     // JDK-8281384 - buffer might be larger than data and null terminator not at the end
> 
> Minor: We generally don't include the bug ID of the bug we are fixing in a comment (and I see no need here).

Although, since the previous line does, I don't mind if you leave it.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1724#discussion_r1969968941


More information about the openjfx-dev mailing list