RFR: 8307160: [REDO] Enable the permissive- flag on the Microsoft Visual C compiler [v2]

Julian Waters jwaters at openjdk.org
Mon Aug 7 08:17:35 UTC 2023


On Tue, 1 Aug 2023 08:19:06 GMT, Julian Waters <jwaters at openjdk.org> wrote:

>> src/hotspot/os/windows/symbolengine.cpp line 114:
>> 
>>> 112:       _capacity = (int)(sizeof(_fallback_buffer) / sizeof(T));
>>> 113:     }
>>> 114:     _p[0] = (T) '\0';
>> 
>> I find this use of `'\0'` quite suspicious in itself, but it is consistent with the use of `'X'` in `imprint_sentinel()`. I'm unclear what types are possible for `T` in this code.
>
> There are currently only 2 possible types of HMODULE and char/uint8_t for T at the moment. Weirdly enough only line 126 errors out without the cast while line 114, despite having the same problem, doesn't, but I added the cast to both lines for consistency. If someone else knows why I could probably deal with this code in a better way besides just casting it to T (which I also am reluctant to do)

I just checked and the value of the sentinel is ultimately the prvalue 88. I don't know if we'd want to replace all the weird char usages here with explicit values of 0 (and 88 for the sentinel). Maybe future reviews can help with that

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15096#discussion_r1285533375



More information about the security-dev mailing list