/* * Copyright (c) 2016 - present Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ package codetoanalyze.java.quandary; import com.facebook.infer.models.InferTaint; public class Recursion { public static void divergeOk() { divergeOk(); } public static void callSinkThenDiverge(Object param) { InferTaint.inferSensitiveSink(param); callSinkThenDiverge(param); } public static void callSinkThenDivergeBad() { callSinkThenDiverge(InferTaint.inferSecretSource()); } public static void safeRecursionCallSink(int i, Object param) { if (i == 0) return; InferTaint.inferSensitiveSink(param); safeRecursionCallSink(i - 1, param); } public static void safeRecursionCallSinkBad() { safeRecursionCallSink(5, InferTaint.inferSecretSource()); } public static void recursionBad(int i, Object param) { if (i == 0) return; InferTaint.inferSensitiveSink(param); recursionBad(i - 1, InferTaint.inferSecretSource()); } }