EA-43240 - AIOOBE: ClassReader.a
Index out of bounds from ASM
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.jet.plugin.versions;
|
package org.jetbrains.jet.plugin.versions;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import com.intellij.openapi.diagnostic.Logger;
|
||||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||||
import com.intellij.openapi.util.Ref;
|
import com.intellij.openapi.util.Ref;
|
||||||
import com.intellij.openapi.vfs.VirtualFile;
|
import com.intellij.openapi.vfs.VirtualFile;
|
||||||
@@ -31,12 +32,14 @@ import org.jetbrains.asm4.Opcodes;
|
|||||||
import org.jetbrains.jet.lang.resolve.java.AbiVersionUtil;
|
import org.jetbrains.jet.lang.resolve.java.AbiVersionUtil;
|
||||||
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||||
|
|
||||||
|
import java.lang.Throwable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Important! This is not a stub-based index. And it has its own version
|
* Important! This is not a stub-based index. And it has its own version
|
||||||
*/
|
*/
|
||||||
public class KotlinAbiVersionIndex extends ScalarIndexExtension<Integer> {
|
public class KotlinAbiVersionIndex extends ScalarIndexExtension<Integer> {
|
||||||
|
private static final Logger LOG = Logger.getInstance(KotlinAbiVersionIndex.class);
|
||||||
|
|
||||||
public static final KotlinAbiVersionIndex INSTANCE = new KotlinAbiVersionIndex();
|
public static final KotlinAbiVersionIndex INSTANCE = new KotlinAbiVersionIndex();
|
||||||
|
|
||||||
@@ -58,6 +61,7 @@ public class KotlinAbiVersionIndex extends ScalarIndexExtension<Integer> {
|
|||||||
final Map<Integer, Void> result = Maps.newHashMap();
|
final Map<Integer, Void> result = Maps.newHashMap();
|
||||||
final Ref<Boolean> annotationPresent = new Ref<Boolean>(false);
|
final Ref<Boolean> annotationPresent = new Ref<Boolean>(false);
|
||||||
|
|
||||||
|
try {
|
||||||
ClassReader classReader = new ClassReader(inputData.getContent());
|
ClassReader classReader = new ClassReader(inputData.getContent());
|
||||||
classReader.accept(new ClassVisitor(Opcodes.ASM4) {
|
classReader.accept(new ClassVisitor(Opcodes.ASM4) {
|
||||||
@Override
|
@Override
|
||||||
@@ -84,6 +88,10 @@ public class KotlinAbiVersionIndex extends ScalarIndexExtension<Integer> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
|
}, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
|
||||||
|
}
|
||||||
|
catch (Throwable e) {
|
||||||
|
LOG.warn("Indexing ABI version for file " + inputData.getFile(), e);
|
||||||
|
}
|
||||||
|
|
||||||
if (annotationPresent.get() && result.isEmpty()) {
|
if (annotationPresent.get() && result.isEmpty()) {
|
||||||
// No version at all: the class is too old
|
// No version at all: the class is too old
|
||||||
|
|||||||
Reference in New Issue
Block a user