PVS-StudioWarnings

PVS-Studio warning V557 for QuantLib

Nov 18th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.08 KB | None | 0 0
  1. Handle<YieldTermStructure> md0Yts() {
  2.   ....
  3.   double q6mh[] = {
  4.     0.0001,0.0001,0.0001,0.0003,0.00055,0.0009,0.0014,0.0019,
  5.     0.0025,0.0031,0.00325,0.00313,0.0031,0.00307,0.00309,
  6.     0.00339,0.00316,0.00326,0.00335,0.00343,0.00358,0.00351,
  7.     0.00388,0.00404,0.00425,0.00442,0.00462,0.00386,0.00491,
  8.     0.00647,0.00837,0.01033,0.01218,0.01382,0.01527,0.01654,
  9.     0.0177,0.01872,0.01959,0.0203,0.02088,0.02132,0.02164,
  10.     0.02186,0.02202,0.02213,0.02222,0.02229,0.02234,0.02238,
  11.     0.02241,0.02243,0.02244,0.02245,0.02247,0.0225,0.02284,
  12.     0.02336,0.02407,0.0245 };
  13.   ....
  14.   for(int i=0;i<10+18+37;i++) {
  15.     q6m.push_back(
  16.       boost::shared_ptr<Quote>(new SimpleQuote(q6mh[i])));
  17.   }
  18.   ....
  19. }
  20.  
  21. This suspicious code was found in QuantLib project by PVS-Studio static code analyzer.
  22. Warning message is:
  23. V557 Array overrun is possible. The value of 'i' index could reach 64. markovfunctional.cpp 176
  24.  
  25. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment