RFR: 8280474: Garbage value passed to getLocaleInfoWrapper in HostLocaleProviderAdapter_md
Alan Bateman
alanb at openjdk.java.net
Sat Jan 22 12:17:07 UTC 2022
On Fri, 21 Jan 2022 19:28:21 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:
> Reported by clang-tidy. Verified manually by running
>
> Calendar c = Calendar.getInstance();
> System.out.println (c.getDisplayNames(Calendar.MONTH, Calendar.SHORT_STANDALONE, Locale.getDefault()));
>
> with `-Djava.locale.providers=HOST`
>
> Without the fix the WINAPI functions fail, and [this block](https://github.com/openjdk/jdk/blame/739769c8fc4b496f08a92225a12d07414537b6c0/src/java.base/windows/native/libjava/HostLocaleProviderAdapter_md.c#L857) is never entered. With the fix this block is entered and sensible values are stored in the returned array.
>
> No test because the observable effect with and without the fix was the same; apparently there's a fallback to another provider that works.
Good find.
-------------
Marked as reviewed by alanb (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/7184
More information about the core-libs-dev
mailing list