PVS-StudioWarnings

PVS-Studio warning V557 for TortoiseGIT

Nov 20th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. static int
  2. datasource_to_index(svn_diff_datasource_e datasource)
  3. {
  4.   switch (datasource)
  5.   {
  6.     ....
  7.   }
  8.   return -1;
  9. }
  10.  
  11. static svn_error_t *
  12. token_compare(....)
  13. {
  14.   ....
  15.   int idx = datasource_to_index(file_token[i]->datasource);
  16.   file[i] = &file_baton->files[idx];
  17.   ....
  18. }
  19.  
  20. This suspicious code was found in TortoiseGIT project by PVS-Studio static code analyzer.
  21. Warning message is:
  22. V557 Array underrun is possible. The value of 'idx' index could reach -1. diff_file.c 1052
  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