RFR: 8267130: Memory Overflow in Disassembler::load_library

Thomas Stuefe stuefe at openjdk.java.net
Fri May 14 08:11:37 UTC 2021


On Fri, 14 May 2021 02:17:29 GMT, Wang Huang <whuang at openjdk.org> wrote:

> * reproduce: 
>   put your libjvm.so in a long enough path, such like

Hi @Wanghuang-Huawei ,

Long term this coding may benefit by using stringStream, which takes care of truncating (or dynamically allocating) memory as well as string appending.

But for this fix, I think this is mostly fine. See inline remarks.

Cheers, Thomas

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?

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

Changes requested by stuefe (Reviewer).

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


More information about the hotspot-compiler-dev mailing list