RFR: 8304685: heap-buffer-overflow in libjdwp [v2]

Kevin Walls kevinw at openjdk.org
Fri May 12 20:29:53 UTC 2023


On Fri, 12 May 2023 19:39:10 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> Kevin Walls has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   move skipWhitespace to start
>
> src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c line 93:
> 
>> 91:         if ((i + 1) == argc) {
>> 92:             break; // finished: do not call skipWhitespace again
>> 93:         }
> 
> It seems a bit odd, because you are breaking out of the middle of the loop by using a breakout condition that is already in the `for` statement, and now serves no purpose. I think I like the idea of moving `skipWhitespace(p)` to the start of the loop. No need to skip in on the first iteration. It will just return p.

Yes, could have removed the condition from the for loop, but doing that can look surprising/unusual, so I left it in.

Putting skipWhitespace at the start is maybe more elegant? 8-)  No extra arithmetic to read.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13964#discussion_r1192766540


More information about the serviceability-dev mailing list