RFR: JDK-8327986: ASAN reports use-after-free in DirectivesParserTest.empty_object_vm
Vladimir Kozlov
kvn at openjdk.org
Tue Mar 26 16:46:29 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.
Looks good.
-------------
Marked as reviewed by kvn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/18235#pullrequestreview-1961106669
More information about the hotspot-compiler-dev
mailing list