text: /* TEMPLATE GENERATED TESTCASE FILE
  Filename: CWE190_Integer_Overflow__short_rand_square_82_bad.cpp
  Label Definition File: CWE190_Integer_Overflow.label.xml
  Template File: sources-sinks-82_bad.tmpl.cpp
  */
  /*
   * @description
   * CWE: 190 Integer Overflow
   * BadSource: rand Set data to result of rand()
   * GoodSource: Set data to a small, non-zero number (two)
   * Sinks: square
   *    GoodSink: Ensure there will not be an overflow before squaring data
   *    BadSink : Square data, which can lead to overflow
   * 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 "CWE190_Integer_Overflow__short_rand_square_82.h"
  
  #include <math.h>
  
  namespace CWE190_Integer_Overflow__short_rand_square_82
  {
  
  void CWE190_Integer_Overflow__short_rand_square_82_bad::action(short data)
  {
      {
          /* POTENTIAL FLAW: if (data*data) > SHRT_MAX, this will overflow */
          short result = data * data;
          printIntLine(result);
      }
  }
  
  }
  #endif /* OMITBAD */
  