RFR: 8267130: Memory Overflow in Disassembler::load_library

Wang Huang whuang at openjdk.java.net
Fri May 14 08:39:42 UTC 2021


On Fri, 14 May 2021 08:03:43 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> * reproduce: 
>>   put your libjvm.so in a long enough path, such like
>
> src/hotspot/share/compiler/disassembler.cpp line 807:
> 
>> 805:   if (jvm_offset >= 0) {
>> 806:     // 1. <home>/lib/<vm>/libhsdis-<arch>.so
>> 807:     if (jvm_offset + strlen(hsdis_library_name) + strlen(os::dll_file_extension()) < JVM_MAXPATHLEN) {
> 
> Don't we need space for the terminating zero here?

We use `<` here. If we use `<=`, we should consider terminating zero ;-)

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

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


More information about the hotspot-compiler-dev mailing list