RFR: 8281384: Random chars on paste from Windows clipboard [v6]
Lukasz Kostyra
lkostyra at openjdk.org
Wed Mar 26 07:36:21 UTC 2025
On Tue, 25 Mar 2025 18:39:08 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:
>
> remove non unicode textformats
Changes requested by lkostyra (Reviewer).
modules/javafx.graphics/src/main/native-glass/win/GlassClipboard.cpp line 207:
> 205: {
> 206: addPair(GLASS_TEXT_PLAIN, CF_UNICODETEXT);
> 207: addPair(GLASS_TEXT_PLAIN_LOCALE, CF_TEXT);
I would not remove them, rather replace CF_TEXT with CF_UNICODETEXT. We still need to support the MIMEs.
modules/javafx.graphics/src/main/native-glass/win/GlassClipboard.cpp line 210:
> 208: addPair(GLASS_IMAGE, CF_JAVA_BITMAP);
> 209: addPair(GLASS_FILE_LIST, CF_HDROP);
> 210: addPair(MS_LOCALE, CF_LOCALE);
CF_LOCALE has to stay as CF_LOCALE - it is not a text format.
modules/javafx.graphics/src/main/native-glass/win/GlassClipboard.cpp line 211:
> 209: addPair(GLASS_FILE_LIST, CF_HDROP);
> 210: addPair(MS_LOCALE, CF_LOCALE);
> 211: addPair(MS_OEMTEXT, CF_OEMTEXT);
As above - `s/CF_OEMTEXT/CF_UNICODETEXT`
-------------
PR Review: https://git.openjdk.org/jfx/pull/1724#pullrequestreview-2716134492
PR Review Comment: https://git.openjdk.org/jfx/pull/1724#discussion_r2013535121
PR Review Comment: https://git.openjdk.org/jfx/pull/1724#discussion_r2013537044
PR Review Comment: https://git.openjdk.org/jfx/pull/1724#discussion_r2013537309
More information about the openjfx-dev
mailing list