/* goodB2G() - use badsource and goodsink */ private static void GoodB2G() { /* POTENTIAL FLAW: Set data to a random value between 0.0f (inclusive) and 1.0f (exclusive) */ Random rand = new Random(); data = (float)rand.NextDouble(); CWE369_Divide_by_Zero__float_random_divide_68b.GoodB2GSink(); }
public override void Bad() { /* POTENTIAL FLAW: Set data to a random value between 0.0f (inclusive) and 1.0f (exclusive) */ Random rand = new Random(); data = (float)rand.NextDouble(); CWE369_Divide_by_Zero__float_random_divide_68b.BadSink(); }
/* goodG2B() - use goodsource and badsink */ private static void GoodG2B() { /* FIX: Use a hardcoded number that won't a divide by zero */ data = 2.0f; CWE369_Divide_by_Zero__float_random_divide_68b.GoodG2BSink(); }