RFR: JDK-8327986: ASAN reports use-after-free in DirectivesParserTest.empty_object_vm

Thomas Stuefe stuefe at openjdk.org
Thu Mar 28 07:12:42 UTC 2024


On Tue, 26 Mar 2024 16:43:34 GMT, Vladimir Kozlov <kvn 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.

Thanks @vnkozlov and @djelinski

-------------

PR Comment: https://git.openjdk.org/jdk/pull/18235#issuecomment-2024545864


More information about the hotspot-compiler-dev mailing list