/* * Copyright (c) 2016-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package codetoanalyze.java.quandary; import com.facebook.infer.builtins.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()); } // TODO (#16595757): Requires support for recursion in Ondemand public static void FN_recursionBad(int i, Object param) { if (i == 0) return; InferTaint.inferSensitiveSink(param); FN_recursionBad(i - 1, InferTaint.inferSecretSource()); } }