RFR: JDK-8259843: initialize dli_fname array before calling dll_address_to_library_name

Thomas Stuefe stuefe at openjdk.java.net
Wed Jan 20 08:45:46 UTC 2021


On Wed, 20 Jan 2021 08:29:59 GMT, Lutz Schmidt <lucy at openjdk.org> wrote:

>> Hi David,  I think a return would be clearer but an assert is "better than nothing" .
>> 
>> Best regards, Matthias
>
> With an assert, you assume this is a "cannot occur error". You should be pretty sure to have good test coverage to find all "illegal invocations" before letting a release build escape into the wild.

+1 for the assert.
If you are worried about release, combine assert with release check:
assert(buf && buflen > 1, "sanity");
if (buf == NULL || buflen < 1) return;
Its what I usually do if I want to be super thorough.
Sorry for the bikeshedding :)

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

PR: https://git.openjdk.java.net/jdk/pull/2144


More information about the hotspot-dev mailing list