RFR: JDK-8259843: initialize dli_fname array before calling dll_address_to_library_name
Matthias Baesken
mbaesken at openjdk.java.net
Wed Jan 20 08:24:48 UTC 2021
On Wed, 20 Jan 2021 06:25:50 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> On some platforms like bsd/mac, we call dll_address_to_library_name with a buffer parameter (e.g. char dli_fname[MAXPATHLEN]; ) that has uninitialized content.
>> This is usually no problem because dll_address_to_library_name fills the array, but on some codepaths it seems not to be the case.
>>
>> See also this related sonar issue :
>> https://sonarcloud.io/project/issues?id=jdk&open=AXaE0drk8L9hkQskGEXZ&resolved=false&types=BUG
>
> src/hotspot/share/runtime/frame.cpp line 543:
>
>> 541: bool found;
>> 542:
>> 543: if (buf == NULL || buflen < 1) return;
>
> Can this not just be an assert: buf != NULL && buflen > 0 ?
Hi David, I think a return would be clearer but an assert is "better than nothing" .
Best regards, Matthias
-------------
PR: https://git.openjdk.java.net/jdk/pull/2144
More information about the hotspot-dev
mailing list