Integrated: JDK-8312612: handle WideCharToMultiByte return values

Matthias Baesken mbaesken at openjdk.org
Fri Jul 28 13:48:58 UTC 2023


On Tue, 25 Jul 2023 11:17:23 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> The function WideCharToMultiByte is used at a number of places of the JDK codebase for conversion purposes.
> Unfortunately, the function might fail because of various reasons, so the return value must be checked to avoid undefined behavior or even crashes.
> see
> https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte
> especially
> https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte#return-value
> 
> At most places in the coding the return values are already checked, but some are missing.

This pull request has now been integrated.

Changeset: d9559f9b
Author:    Matthias Baesken <mbaesken at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/d9559f9b24ee76c074cefcaf256d11ef5a7cc5b7
Stats:     32 lines in 3 files changed: 19 ins; 0 del; 13 mod

8312612: handle WideCharToMultiByte return values

Reviewed-by: clanger

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

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



More information about the client-libs-dev mailing list