<i18n dev> RFR 8187772 : JVM crash when currency set on MacOS 10.10 and earlier

Brent Christian brent.christian at oracle.com
Thu Oct 12 18:52:16 UTC 2017


Hi,

Please review my change to prevent a startup crash on earlier versions 
of MacOS.

    Bug: https://bugs.openjdk.java.net/browse/JDK-8187772
Webrev: http://cr.openjdk.java.net/~bchristi/8187772/webrev.00/

When a non-default currency is set in the Language & Region control 
panel, it's reflected as a variant in the locale identifier string.  For 
example, "en_US at currency=RUB" for U.S. English using the Russian rubles 
currency.

convertToPOSIXLocale() is not expecting such variants, nor such a long 
string.  The result is a SEGV from memmove() on line 161.  (Additional 
details are in the bug report.)

The fix truncates the string passed to convertToPOSIXLocale() before any 
'@'-denoted variant tags.

FWIW, the crash only happens on MacOS 10.10 and earlier because later 
versions of MacOS always return a region along with the language (line 
65), so we don't need to query the locale identifier (line 84) to 
determine the region (hyphenPos is never NULL on line 82).

Thanks,
-Brent


More information about the i18n-dev mailing list