RFR: JDK-8327986: ASAN reports use-after-free in DirectivesParserTest.empty_object_vm
Daniel Jeliński
djelinski at openjdk.org
Thu Mar 28 07:05:32 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.
Sure. LGTM.
-------------
Marked as reviewed by djelinski (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/18235#pullrequestreview-1965317277
More information about the hotspot-compiler-dev
mailing list