You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* 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());
|
|
}
|
|
}
|