/* goodB2G2() - use badsource and goodsink by reversing the blocks in the if in the sink function */ private void GoodB2G2() { float data = 0.0f; data = 0.0f; /* POTENTIAL FLAW: data is set to zero */ goodB2G2PublicStatic = true; CWE369_Divide_by_Zero__float_zero_divide_22b.GoodB2G2Sink(data); }
public override void Bad() { float data = 0.0f; data = 0.0f; /* POTENTIAL FLAW: data is set to zero */ badPublicStatic = true; CWE369_Divide_by_Zero__float_zero_divide_22b.BadSink(data); }
/* goodG2B() - use goodsource and badsink */ private void GoodG2B() { float data = 0.0f; /* FIX: Use a hardcoded number that won't a divide by zero */ data = 2.0f; goodG2BPublicStatic = true; CWE369_Divide_by_Zero__float_zero_divide_22b.GoodG2BSink(data); }