Ejemplo n.º 1
0
        /* goodG2B() - use GoodSource and BadSink */
        private static void GoodG2B()
        {
            ushort data;

            /* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */
            data = 2;
            LinkedList <ushort> dataLinkedList = new LinkedList <ushort>();

            dataLinkedList.AddLast(data);
            dataLinkedList.AddLast(data);
            dataLinkedList.AddLast(data);
            CWE191_Integer_Underflow__UInt16_rand_multiply_73b.GoodG2BSink(dataLinkedList);
        }
Ejemplo n.º 2
0
        /* goodB2G() - use BadSource and GoodSink */
        private static void GoodB2G()
        {
            ushort data;

            /* POTENTIAL FLAW: Use a random value */
            data = (ushort)(new Random().Next(ushort.MinValue, ushort.MaxValue));
            LinkedList <ushort> dataLinkedList = new LinkedList <ushort>();

            dataLinkedList.AddLast(data);
            dataLinkedList.AddLast(data);
            dataLinkedList.AddLast(data);
            CWE191_Integer_Underflow__UInt16_rand_multiply_73b.GoodB2GSink(dataLinkedList);
        }
Ejemplo n.º 3
0
        public override void Bad()
        {
            ushort data;

            /* POTENTIAL FLAW: Use a random value */
            data = (ushort)(new Random().Next(ushort.MinValue, ushort.MaxValue));
            LinkedList <ushort> dataLinkedList = new LinkedList <ushort>();

            dataLinkedList.AddLast(data);
            dataLinkedList.AddLast(data);
            dataLinkedList.AddLast(data);
            CWE191_Integer_Underflow__UInt16_rand_multiply_73b.BadSink(dataLinkedList);
        }