On Fri, 26 Aug 2022 12:04:57 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:

>> There seems to be a case where utf_util.c getWideString might leak memory in 
>> an early return.
>
> Matthias Baesken has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Introduce UTF_WARNING and use the fallback

I'm not so sure I agree with enabling this "copy bytes" fallback code that has 
seemingly never been exercised. Until we find a use case where a 
`MultiByteToWideChar` failure is not deemed to be a fatal error, I think we 
should keep the code as is. Note these are possible reasons for 
`MultiByteToWideChar` failing:

    ERROR_INSUFFICIENT_BUFFER. A supplied buffer size was not large enough, or 
it was incorrectly set to NULL.
    ERROR_INVALID_FLAGS. The values supplied for flags were not valid.
    ERROR_INVALID_PARAMETER. Any of the parameter values was invalid.
    ERROR_NO_UNICODE_TRANSLATION. Invalid Unicode was found in a string.

Is there ever a reason we would not want to abort if one of these errors 
happened?

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

PR: https://git.openjdk.org/jdk/pull/9918

Reply via email to