AbstractInsnNode prev = LintUtils.getPrevInstruction(node); if (prev != null && !node.desc.equals("(Ljava/lang/String;)V")) { //$NON-NLS-1$ prev = LintUtils.getPrevInstruction(prev);
AbstractInsnNode prev = LintUtils.getPrevInstruction(node); if (prev != null && !node.desc.equals("(Ljava/lang/String;)V")) { prev = LintUtils.getPrevInstruction(prev);
/** * Returns the previous opcode prior to the given node, ignoring label and * line number nodes * * @param node the node to look up the previous opcode for * @return the previous opcode, or {@link Opcodes#NOP} if no previous node * was found */ public static int getPrevOpcode(@NonNull AbstractInsnNode node) { AbstractInsnNode prev = getPrevInstruction(node); if (prev != null) { return prev.getOpcode(); } else { return Opcodes.NOP; } }
private static void checkValidSetSeed(ClassContext context, MethodInsnNode call) { assert call.name.equals(SET_SEED); // Make sure the argument passed is not a literal AbstractInsnNode prev = LintUtils.getPrevInstruction(call); if (prev == null) { return; } int opcode = prev.getOpcode(); if (opcode == Opcodes.LCONST_0 || opcode == Opcodes.LCONST_1 || opcode == Opcodes.LDC) { context.report(ISSUE, context.getLocation(call), "Do not call `setSeed()` on a `SecureRandom` with a fixed seed: " + "it is not secure. Use `getSeed()`."); } else if (opcode == Opcodes.INVOKESTATIC) { String methodName = ((MethodInsnNode) prev).name; if (methodName.equals("currentTimeMillis") || methodName.equals("nanoTime")) { context.report(ISSUE, context.getLocation(call), "It is dangerous to seed `SecureRandom` with the current time because " + "that value is more predictable to an attacker than the default seed."); } } } }
private void checkInstructionInternal(ClassContext context, ClassNode classNode, AbstractInsnNode instruction) { FieldInsnNode node = (FieldInsnNode) instruction; if (node.getOpcode() == Opcodes.PUTSTATIC && node.owner.equals(FQN_CORDOVA_DEVICE) && node.name.equals(FIELD_NAME_CORDOVA_VERSION)) { AbstractInsnNode prevInstruction = LintUtils.getPrevInstruction(node); if (prevInstruction == null || prevInstruction.getOpcode() != Opcodes.LDC) { return; } LdcInsnNode ldcInsnNode = (LdcInsnNode) prevInstruction; if (ldcInsnNode.cst instanceof String) { mCordovaVersion = createVersion((String) ldcInsnNode.cst); if (mCordovaVersion != null) { validateCordovaVersion(context, mCordovaVersion, context.getLocation(classNode)); } } } }
String owner = node.owner; AbstractInsnNode prev = LintUtils.getPrevInstruction(instruction); if (prev == null || prev.getOpcode() != Opcodes.ALOAD) { return;
return; AbstractInsnNode prev = LintUtils.getPrevInstruction(call); if (prev instanceof LdcInsnNode) { Object cst = ((LdcInsnNode)prev).cst; AbstractInsnNode node = call; for (int i = 0; i < arity; i++) { node = LintUtils.getPrevInstruction(node); if (node == null) { break;
return; AbstractInsnNode prev = LintUtils.getPrevInstruction(call); if (prev instanceof LdcInsnNode) { Object cst = ((LdcInsnNode)prev).cst; AbstractInsnNode node = call; for (int i = 0; i < arity; i++) { node = LintUtils.getPrevInstruction(node); if (node == null) { break;
String owner = node.owner; AbstractInsnNode prev = LintUtils.getPrevInstruction(instruction); if (prev == null || prev.getOpcode() != Opcodes.ALOAD) { return;
AbstractInsnNode prev = LintUtils.getPrevInstruction(call); if (prev == null) { return; prev = LintUtils.getPrevInstruction(prev); if (prev == null || prev.getOpcode() != Opcodes.LDC) { return;
AbstractInsnNode prev = LintUtils.getPrevInstruction(call); if (prev == null) { return; prev = LintUtils.getPrevInstruction(prev); if (prev == null || prev.getOpcode() != Opcodes.LDC) { return;
JumpInsnNode jump = (JumpInsnNode) from; if (jump.label == to) { AbstractInsnNode prev = LintUtils.getPrevInstruction(from); if (prev != null && prev.getType() == AbstractInsnNode.METHOD_INSN) { MethodInsnNode method = (MethodInsnNode) prev;
JumpInsnNode jump = (JumpInsnNode) from; if (jump.label == to) { AbstractInsnNode prev = LintUtils.getPrevInstruction(from); if (prev != null && prev.getType() == AbstractInsnNode.METHOD_INSN) { MethodInsnNode method = (MethodInsnNode) prev;