RFR: 8346881: [ubsan] logSelection.cpp:154:24 / logSelectionList.cpp:72:94 : runtime error: applying non-zero offset 1 to null pointer [v3]

Amit Kumar amitkumar at openjdk.org
Mon Jan 6 07:11:40 UTC 2025


On Fri, 3 Jan 2025 09:17:35 GMT, Christoph Langer <clanger at openjdk.org> wrote:

> I think for the sake of consistency, the loop in logSelectionList.cpp could be transformed into a do {} while(), like in the other two locations, but in any case, the change looks good to me as it is now.

I think `for` loop is better choice for this kind of occasion. Because in logDecorators.cpp : 

  char* token = args_copy;
  char* comma_pos;

these two variables are doing no good by being in function scope. If it would have been a for loop then then would exist in the loop's scope only. As that's the case for `comma_pos` and `cur` here: 

for (char *comma_pos = copy, *cur = copy; success; cur = comma_pos + 1) {


It might not be a big deal but still I find later one appropriate :-)

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

PR Comment: https://git.openjdk.org/jdk/pull/22903#issuecomment-2572434385


More information about the hotspot-runtime-dev mailing list