RFR: JDK-8327986: ASAN reports use-after-free in DirectivesParserTest.empty_object_vm
Thomas Stuefe
stuefe at openjdk.org
Wed Mar 20 06:26:24 UTC 2024
On Tue, 12 Mar 2024 13:57:53 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> ASAN reports a use-after-free, because we feed the string we got from `setlocale` back to `setlocale`, but the libc owns this string, and the libc decided to free it in the meantime.
>
> According to POSIX, it should be valid to pass into setlocale output from setlocale.
>
> However, glibc seems to delete the old string when calling setlocale again:
>
> https://codebrowser.dev/glibc/glibc/locale/setlocale.c.html#198
>
> Best to make a copy, and pass in the copy to setlocale.
Closed, will be part of https://github.com/openjdk/jdk/pull/18230
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18235#issuecomment-2008726551
More information about the hotspot-compiler-dev
mailing list