/* goodG2B() - use goodsource and badsink */ private void GoodG2B() { float data; /* FIX: Use a hardcoded number that won't a divide by zero */ data = 2.0f; CWE369_Divide_by_Zero__float_random_divide_52b.GoodG2BSink(data); }
/* goodB2G() - use badsource and goodsink */ private void GoodB2G() { float data; /* 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_52b.GoodB2GSink(data); }