/* goodB2G() - use BadSource and GoodSink */ private void goodB2G() throws Throwable { byte data; /* POTENTIAL FLAW: Use the maximum size of the data type */ data = Byte.MAX_VALUE; CWE190_Integer_Overflow__byte_max_square_81_base baseObject = new CWE190_Integer_Overflow__byte_max_square_81_goodB2G(); baseObject.action(data); }
/* goodG2B() - use GoodSource and BadSink */ private void goodG2B() throws Throwable { byte data; /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */ data = 2; CWE190_Integer_Overflow__byte_max_square_81_base baseObject = new CWE190_Integer_Overflow__byte_max_square_81_goodG2B(); baseObject.action(data); }