Exemplo n.º 1
0
        /* goodG2B() - use goodsource and badsink */
        private static void GoodG2B()
        {
            short data = CWE191_Integer_Underflow__Short_min_multiply_61b.GoodG2BSource();

            if (data < 0) /* ensure we won't have an overflow */
            {
                /* POTENTIAL FLAW: if (data * 2) < short.MinValue, this will underflow */
                short result = (short)(data * 2);
                IO.WriteLine("result: " + result);
            }
        }