On Tue, 25 Feb 2025 14:36:59 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

>> Oliver Schmidtmer has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   check both UTF16 bytes
>
> 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.

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

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

Reply via email to