Commit 5e722c68 authored by Skylot's avatar Skylot

fix issues reported by coverity

parent 10198bc8
...@@ -535,6 +535,9 @@ public class InsnGen { ...@@ -535,6 +535,9 @@ public class InsnGen {
if (!elType.isTypeKnown()) { if (!elType.isTypeKnown()) {
LOG.warn("Unknown array element type: {} in mth: {}", elType, mth); LOG.warn("Unknown array element type: {} in mth: {}", elType, mth);
elType = insnElementType.isTypeKnown() ? insnElementType : elType.selectFirst(); elType = insnElementType.isTypeKnown() ? insnElementType : elType.selectFirst();
if (elType == null) {
throw new JadxRuntimeException("Null array element type");
}
} }
insn.mergeElementType(elType); insn.mergeElementType(elType);
......
...@@ -7,6 +7,7 @@ import jadx.core.utils.InsnUtils; ...@@ -7,6 +7,7 @@ import jadx.core.utils.InsnUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -20,6 +21,7 @@ public abstract class InsnArg extends Typed { ...@@ -20,6 +21,7 @@ public abstract class InsnArg extends Typed {
private static final Logger LOG = LoggerFactory.getLogger(InsnArg.class); private static final Logger LOG = LoggerFactory.getLogger(InsnArg.class);
@Nullable("Null for method arguments")
protected InsnNode parentInsn; protected InsnNode parentInsn;
public static RegisterArg reg(int regNum, ArgType type) { public static RegisterArg reg(int regNum, ArgType type) {
...@@ -70,6 +72,7 @@ public abstract class InsnArg extends Typed { ...@@ -70,6 +72,7 @@ public abstract class InsnArg extends Typed {
return false; return false;
} }
@Nullable
public InsnNode getParentInsn() { public InsnNode getParentInsn() {
return parentInsn; return parentInsn;
} }
......
...@@ -52,14 +52,14 @@ public class ConstInlinerVisitor extends AbstractVisitor { ...@@ -52,14 +52,14 @@ public class ConstInlinerVisitor extends AbstractVisitor {
long lit = ((LiteralArg) arg).getLiteral(); long lit = ((LiteralArg) arg).getLiteral();
SSAVar sVar = insn.getResult().getSVar(); SSAVar sVar = insn.getResult().getSVar();
if (lit == 0) { if (lit == 0 && checkObjectInline(sVar)) {
if (checkObjectInline(sVar)) {
if (sVar.getUseCount() == 1) { if (sVar.getUseCount() == 1) {
insn.getResult().getAssignInsn().add(AFlag.DONT_INLINE); InsnNode assignInsn = insn.getResult().getAssignInsn();
if (assignInsn != null) {
assignInsn.add(AFlag.DONT_INLINE);
} }
return false;
} }
return false;
} }
ArgType resType = insn.getResult().getType(); ArgType resType = insn.getResult().getType();
// make sure arg has correct type // make sure arg has correct type
......
...@@ -468,6 +468,10 @@ public class BlockFinallyExtract extends AbstractVisitor { ...@@ -468,6 +468,10 @@ public class BlockFinallyExtract extends AbstractVisitor {
if (pred == null) { if (pred == null) {
return; return;
} }
IgnoreEdgeAttr edgeAttr = pred.get(AType.IGNORE_EDGE);
if (edgeAttr == null) {
return;
}
List<BlockNode> merge = new LinkedList<BlockNode>(); List<BlockNode> merge = new LinkedList<BlockNode>();
for (BlockNode blockNode : pred.getSuccessors()) { for (BlockNode blockNode : pred.getSuccessors()) {
if (blockNode.contains(AFlag.RETURN)) { if (blockNode.contains(AFlag.RETURN)) {
...@@ -488,7 +492,6 @@ public class BlockFinallyExtract extends AbstractVisitor { ...@@ -488,7 +492,6 @@ public class BlockFinallyExtract extends AbstractVisitor {
if (origReturnBlock == null) { if (origReturnBlock == null) {
return; return;
} }
IgnoreEdgeAttr edgeAttr = pred.get(AType.IGNORE_EDGE);
for (BlockNode mb : merge) { for (BlockNode mb : merge) {
if (mb == origReturnBlock) { if (mb == origReturnBlock) {
continue; continue;
......
...@@ -102,7 +102,7 @@ public class JadxUpdate { ...@@ -102,7 +102,7 @@ public class JadxUpdate {
HttpURLConnection con = (HttpURLConnection) obj.openConnection(); HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET"); con.setRequestMethod("GET");
if (con.getResponseCode() == 200) { if (con.getResponseCode() == 200) {
Reader reader = new InputStreamReader(con.getInputStream()); Reader reader = new InputStreamReader(con.getInputStream(), "UTF-8");
return GSON.fromJson(reader, type); return GSON.fromJson(reader, type);
} }
return null; return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment