On Fri, 3 May 2024 15:28:05 GMT, Adam Sotona <asot...@openjdk.org> wrote:
> Specifically corrupted constant pool of a class file can cause > ClassCastException, when the entries are accessed by Class-File API in exact > order. > > This fix avoids the ClassCastException and throws ConstantPoolException > instead. > Test is attached. > > Please review. > > Thanks, > Adam src/java.base/share/classes/jdk/internal/classfile/impl/ClassReaderImpl.java line 402: > 400: int tag = readU1(offset); > 401: final int q = offset + 1; > 402: if (tag == TAG_UTF8) { Can we call into the tag accepting entryByIndex? e.g., if (entryByIndex(index, TAG_UTF8) instanceof AbstractPoolEntry.Utf8EntryImpl utf8) { return ... } throw new ... ? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19088#discussion_r1589423345