WALA
WALA copied to clipboard
InvalidBytecodeException false-positive (Trying to manipulate a pair of one-word items but one of them is two words)
I just noticed a false-positive InvalidBytecodeException while analyzing spring-core-3.2.16.RELEASE.jar with WALA 1.4.3.
I get an UnimplementedError when getting the IR from Lorg/springframework/asm/ClassReader. readConst(I[C)Ljava/lang/Object;:
Exception in thread "main" com.ibm.wala.util.debug.UnimplementedError
at com.ibm.wala.util.debug.Assertions.UNREACHABLE(Assertions.java:46)
at com.ibm.wala.classLoader.ShrikeCTMethod.makeDecoder(ShrikeCTMethod.java:110)
at com.ibm.wala.classLoader.ShrikeBTMethod.processBytecodesWithShrikeBT(ShrikeBTMethod.java:468)
at com.ibm.wala.classLoader.ShrikeBTMethod.computeBCInfo(ShrikeBTMethod.java:261)
at com.ibm.wala.classLoader.ShrikeBTMethod.getBCInfo(ShrikeBTMethod.java:147)
at com.ibm.wala.classLoader.ShrikeBTMethod.getInstructions(ShrikeBTMethod.java:715)
at com.ibm.wala.classLoader.ShrikeIRFactory.makeIR(ShrikeIRFactory.java:53)
at com.ibm.wala.ssa.DefaultIRFactory.makeIR(DefaultIRFactory.java:64)
at com.ibm.wala.ssa.SSACache.findOrCreateIR(SSACache.java:78)
at com.ibm.wala.ipa.callgraph.AnalysisCache.getIR(AnalysisCache.java:74)
at com.ibm.wala.ipa.callgraph.AnalysisCache.getIR(AnalysisCache.java:79)
at test.Main.main(Main.java:36)
Under the hood, this is a com.ibm.wala.shrikeBT.Decoder$InvalidBytecodeException: Trying to manipulate a pair of one-word items but one of them is two words. I believe this to be incorrect. (I verified the class using ASM 6.0’s CheckClassAdapter and it doesn’t show any verification errors.)
The following minimal example reproduces the problem:
public static void main(String[] args) throws Exception {
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope("spring-core-3.2.16.RELEASE.jar", null);
IClassHierarchy cha = ClassHierarchyFactory.make(scope);
IClass classReaderClass = cha
.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application, "Lorg/springframework/asm/ClassReader"));
AnalysisCache analysisCache = new AnalysisCacheImpl();
IMethod readConstMethod = classReaderClass.getMethod(Selector.make("readConst(I[C)Ljava/lang/Object;"));
IR ir = analysisCache.getIR(readConstMethod);
}
Hope this helps.