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.

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

Commit messages:
 - JDK-8312612

Changes: https://git.openjdk.org/jdk/pull/15015/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15015&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8312612
  Stats: 33 lines in 3 files changed: 20 ins; 0 del; 13 mod
  Patch: https://git.openjdk.org/jdk/pull/15015.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15015/head:pull/15015

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

Reply via email to