That is interesting, thanks. I'll add the info to the bug report.
I can reproduce the crash on 10.9 when setting a non-default calendar
instead of a currency. But I still cannot reproduce it on 10.12.
-Brent
On 10/12/17 2:28 PM, Xueming Shen wrote:
Brent,
My mac build fails / crashes for a while at exactly the same location.
The fix seems
have solved the problem. However my osx is 10.11.5/OSX El Capitan, and
in my case
the locale variable looks like "en-US@calendar=iso8601". It's not the
currency, but
the calendar is attached after "@"
Just FYI.
sherman
On 10/12/17, 11:52 AM, Brent Christian wrote:
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@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