On Tue, 25 Feb 2025 15:21:22 GMT, Oliver Schmidtmer <oschmidt...@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

Reply via email to