text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE191_Integer_Underflow__short_min_multiply_82_bad.cpp
  Label Definition File: CWE191_Integer_Underflow.label.xml
  Template File: sources-sinks-82_bad.tmpl.cpp
  */
  /*
   * @description
   * CWE: 191 Integer Underflow
   * BadSource: min Set data to the min value for short
   * GoodSource: Set data to a small, non-zero number (negative two)
   * Sinks: multiply
   *    GoodSink: Ensure there will not be an underflow before multiplying data by 2
   *    BadSink : If data is negative, multiply by 2, which can cause an underflow
   * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer
   *
   * */
  #ifndef OMITBAD
  
  #include "std_testcase.h"
  #include "CWE191_Integer_Underflow__short_min_multiply_82.h"
  
  namespace CWE191_Integer_Underflow__short_min_multiply_82
  {
  
  void CWE191_Integer_Underflow__short_min_multiply_82_bad::action(short data)
  {
      if(data < 0) /* ensure we won't have an overflow */
      {
          /* POTENTIAL FLAW: if (data * 2) < SHRT_MIN, this will underflow */
          short result = data * 2;
          printIntLine(result);
      }
  }
  
  }
  #endif /* OMITBAD */
  