RFR: 8334169: Long arguments of attach operation are silently truncated on Windows [v2]

Alex Menkov amenkov at openjdk.org
Mon Jul 15 19:58:54 UTC 2024


On Sat, 13 Jul 2024 01:45:50 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

>> test/hotspot/jtreg/serviceability/attach/LongArgTest.java line 79:
>> 
>>> 77:         // Value length exceeds 1K.
>>> 78:         Test withLongValue() {
>>> 79:             flagValue = generateValue(1024 + 1);
>> 
>> Shouldn't we also be testing exactly 1024 and expect it to work?
>
> good question!
> tried to make it 1024 and it does not work!
> Windows VirtualMachineImpl has one more issue - it uses 1024 char buffers, but it should be (1024 + 1) as AttachListener does (1 extra char to 0-terminator), so maximum argument size on windows is 1023.
> Will fix it.

Fixed the issue, also renamed ` jstring_to_cstring` argument to make it clear that buffer size is expected and updated callers to use `sizeof`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19780#discussion_r1678321643


More information about the serviceability-dev mailing list