On Wed, 2 Oct 2024 13:29:22 GMT, Shaojin Wen <s...@openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/classfile/impl/RawBytecodeHelper.java >> line 449: >> >>> 447: } >>> 448: >>> 449: if ((nextBci += len) > end) { >> >> This change makes it that `nextBci` will no longer monotonically increase in >> case of a malformed special instruction. >> >> Suggestion: >> >> if (len <= 0 || (nextBci += len) > end) { > > The checkSpecialInstruction has already added the 'len <= 0' process, so > there is no need to check 'len <= '0' again. `checkSpecialInstruction` will return `-1` in the following cases: * `code == WIDE` and `bci + 1 >= end` * `code == TABLESWITCH` and `align(bci + 1) + 3 * 4 >= end` * `code == LOOKUPSWITCH` and * `align(bci + 1) + 2 * 4 >= end` * or `npairs` is out of range Which will cause `nextBci` to be decremented in those cases in the proposed implementation. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21300#discussion_r1785154110