On Tue, 27 Aug 2024 13:06:26 GMT, Thomas Stuefe <stu...@openjdk.org> wrote:
>> IIUC for compact strings, with non-latin-1 each pair of bytes would require >> at most 3-bytes to encode so you'd need 2/3 of INT_MAX. With latin-1 it >> would be 1/2 INT_MAX. But yes I suppose in theory you might be able to get >> an overflow on 32-bit. Need to think more about what could even be done for >> this case ... and whether it is worth trying ... > > SymbolTable does check the length and truncates with a warning (see > https://github.com/openjdk/jdk/blob/0c332e9de919184d8a4678bfd7c274fcef02b3e2/src/hotspot/share/classfile/symbolTable.cpp#L351-L360) > though it does not seem to check for values < 0. Maybe we should add that. A negative value should only come from integer overflow and we have been eradicating the sources for that at the higher levels. But maybe it is worth adding the negative check in `symbolTable` ... ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20560#discussion_r1733520437