Advertisement
PVS-StudioWarnings

PVS-Studio warning V557 for saga

Nov 26th, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #define DATUM_CODE_LENGTH           7
  2.  
  3. typedef struct Datum_Table_Row
  4. {
  5.   ...
  6.   char Code[DATUM_CODE_LENGTH];
  7.   ...
  8. } Datum_Row;
  9.  
  10. long Initialize_Datums_File(const char *File_7Parms,
  11.                             const char *File_3Parms)
  12. {
  13.   ...
  14.   for (i = 0; i < DATUM_CODE_LENGTH; i++)
  15.     Datum_Table_3Param[index].Code[i] =
  16.       Datum_Table_3Param[index].Code[i+1];
  17.   ...
  18. }
  19.  
  20. This suspicious code was found in saga project by PVS-Studio static code analyzer.
  21. Warning message is:
  22. V557 Array overrun is possible. The value of 'i + 1' index could reach 7. pj_geotrans datum.c 367
  23.  
  24. 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
Advertisement