RFR: 8281384: Random chars on paste from Windows clipboard [v2]
Kevin Rushforth
kcr at openjdk.org
Wed Feb 26 12:46:08 UTC 2025
On Tue, 25 Feb 2025 15:21:22 GMT, Oliver Schmidtmer <oschmidtmer at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/glass/ui/win/WinSystemClipboard.java line 258:
>>
>>> 256: int nullTerm = data.length - 2;
>>> 257: for (int i = 0; i < data.length; i += 2) {
>>> 258: if (data[i] == 0) {
>>
>> Since this is UTF-16, don't you need to check that both the even and odd bytes are 0?
>>
>>
>> if (data[i] == 0 && data[i+1] == 0) {
>>
>>
>> If you do this, you will want to validate that the length is even (if it isn't already ensured by `popBytes`).
>
> done and aborting loop now if there's only one byte left.
Looks good now. I'll test and then finish my review.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1724#discussion_r1971521731
More information about the openjfx-dev
mailing list