Commit 5e722c68 authored by Skylot's avatar Skylot

fix issues reported by coverity

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