Merge branch 'Konloch:master' into master

This commit is contained in:
Miroslav Hajda 2021-09-18 17:35:39 +02:00 committed by GitHub
commit f8f0aea158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 12 deletions

View File

@ -43,12 +43,12 @@
<smali.version>2.5.2</smali.version>
<snakeyaml.version>1.29</snakeyaml.version>
<xpp3.version>1.1.4c</xpp3.version>
<jadx.version>f681c89</jadx.version>
<dex2jar.version>v24</dex2jar.version>
<jadx.version>8e89a2e</jadx.version>
<dex2jar.version>v26</dex2jar.version>
<darklaf.version>2.7.2</darklaf.version>
<darklaf-extensions-rsta.version>0.3.4</darklaf-extensions-rsta.version>
<webp-imageio.version>0.2.2</webp-imageio.version>
<semantic-version.version>2.1.0</semantic-version.version>
<semantic-version.version>2.1.1</semantic-version.version>
<treelayout.version>1.0.3</treelayout.version>
<antlr4.version>4.9.2</antlr4.version>
<js.version>21.2.0</js.version>

View File

@ -5,7 +5,6 @@ import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Objects;
import org.jd.core.v1.model.classfile.constant.Constant;
import org.jd.core.v1.model.classfile.constant.ConstantClass;
import org.jd.core.v1.model.classfile.constant.ConstantUtf8;
@ -29,8 +28,9 @@ public class JDGUIClassFileUtil
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis)) {
int magic = dis.readInt();
if (magic != ClassFileReader.JAVA_MAGIC_NUMBER)
if (magic != ClassFileReader.JAVA_MAGIC_NUMBER) {
throw new ClassFileFormatException("Invalid Java .class file");
}
/* int minor_version = */
dis.readUnsignedShort();
@ -43,16 +43,18 @@ public class JDGUIClassFileUtil
dis.readUnsignedShort();
int this_class = dis.readUnsignedShort();
if (this_class > Objects.requireNonNull(constants).length) {
if (this_class > constants.length) {
throw new ClassFileFormatException("Unknown Java structure");
}
Constant c = constants[this_class];
if ((c == null) || (c.getTag() != Constant.CONSTANT_Class))
if ((c == null) || (c.getTag() != Constant.CONSTANT_Class)) {
throw new ClassFileFormatException("Invalid constant pool");
}
c = constants[((ConstantClass) c).getNameIndex()];
if ((c == null) || (c.getTag() != Constant.CONSTANT_Utf8))
if ((c == null) || (c.getTag() != Constant.CONSTANT_Utf8)) {
throw new ClassFileFormatException("Invalid constant pool");
}
String internalClassName = ((ConstantUtf8) c).getValue();
String pathSuffix = internalClassName.replace(
@ -61,8 +63,9 @@ public class JDGUIClassFileUtil
int index = pathToClass.indexOf(pathSuffix);
if (index < 0)
if (index < 0) {
throw new ClassFileFormatException("Invalid internal class name");
}
directoryPath = pathToClass.substring(0, index);
} catch (IOException e) {
@ -87,9 +90,6 @@ public class JDGUIClassFileUtil
private static Constant[] DeserializeConstants(DataInputStream dis)
throws IOException {
int count = dis.readUnsignedShort();
if (count == 0)
return null;
Constant[] constants = new Constant[count];
for (int i = 1; i < count; i++) {
@ -112,12 +112,15 @@ public class JDGUIClassFileUtil
case Constant.CONSTANT_FieldRef:
case Constant.CONSTANT_MethodRef:
case Constant.CONSTANT_InterfaceMethodRef:
case Constant.CONSTANT_InvokeDynamic:
case Constant.CONSTANT_NameAndType:
case Constant.CONSTANT_Integer:
case Constant.CONSTANT_Float:
dis.read();
case Constant.CONSTANT_MethodHandle:
dis.read();
case Constant.CONSTANT_String:
case Constant.CONSTANT_MethodType:
dis.read();
dis.read();
break;