On Sat, 18 Apr 2026 13:14:15 GMT, Yasumasa Suenaga <[email protected]> wrote:

> ArrayIndexOutOfBoundsException as following was hiding in 
> ClhsdbPrintAll.java. See attached .jtr file in JBS.
> 
> java.lang.ArrayIndexOutOfBoundsException: 7 6
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.oops.ResolvedMethodArray.getAt(ResolvedMethodArray.java:60)
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.oops.ConstantPoolCache.getMethodEntryAt(ConstantPoolCache.java:99)
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.interpreter.BytecodeWithCPIndex.indexForFieldOrMethod(BytecodeWithCPIndex.java:57)
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.interpreter.BytecodeGetPut.toString(BytecodeGetPut.java:58)
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.ui.classbrowser.HTMLGenerator$1.visit(HTMLGenerator.java:685)
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.interpreter.BytecodeDisassembler.decode(BytecodeDisassembler.java:156)
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.ui.classbrowser.HTMLGenerator.genHTML(HTMLGenerator.java:659)
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor$18$1.visit(CommandProcessor.java:876)
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.classfile.ClassLoaderData.classesDo(ClassLoaderData.java:113)
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.classfile.ClassLoaderDataGraph.classesDo(ClassLoaderDataGraph.java:84)
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor$18.doit(CommandProcessor.java:869)
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:2051)
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:2021)
> at 
> jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.run(CommandProcessor.java:1892)
> at jdk.hotspot.agent/sun.jvm.hotspot.CLHSDB.run(CLHSDB.java:113)
> at jdk.hotspot.agent/sun.jvm.hotspot.CLHSDB.main(CLHSDB.java:45)
> at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runCLHSDB(SALauncher.java:285)
> at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:507)
> 
> 
> AFAICS all of failures are caused by `getfield` bytecode. We can see it in 
> `javap`, but in SA, another bytecode values (e.g. "234") were detected. Thus 
> `getfield` would not be handled as field operation at folloing code in 
> BytecodeWithCPIndex.java, eventually the exception was thrown.
> 
> 
>      if (cpCache == null) {
>         return cpCacheIndex;
>      } else if (code() == Bytecodes._invokedynamic) {
>         return cpCache.getIndyEntryAt(cpCacheIndex).getConstantPoolIndex();
>      } else if (Bytecodes.isFieldCode(code())) {
>         return cpCache.getFieldEntryAt(cpCacheIndex).getConstantPoolIndex();
>      } else {
>         return cpCache.getMethodEntryAt(cpCacheInde...

This pull request has now been integrated.

Changeset: df8a940e
Author:    Yasumasa Suenaga <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/df8a940e4fb3061642fe5a0c58f9572211057970
Stats:     6 lines in 1 file changed: 4 ins; 0 del; 2 mod

8382485: ArrayIndexOutOfBoundsException was hiding in ClhsdbPrintAll.jtr

Reviewed-by: cjplummer, kevinw

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

PR: https://git.openjdk.org/jdk/pull/30808

Reply via email to