PVS-StudioWarnings

PVS-Studio warning V557 for Geant4

Nov 10th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. void
  2. G4HEInelastic::MediumEnergyClusterProduction(....)
  3. {
  4.   ....
  5.   G4double alem[] = {1.40, 2.30, 2.70, 3.00, 3.40, 4.60, 7.00};
  6.   ....
  7.   for (j = 1; j < 8; j++) {
  8.     if (alekw < alem[j]) {
  9.       jmax = j;
  10.       break;
  11.     }
  12.   }
  13.   ....
  14. }
  15.  
  16. This suspicious code was found in Geant4 project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V557 Array overrun is possible. The value of 'j' index could reach 7. g4heinelastic.cc 4682
  19.  
  20. 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