PVS-StudioWarnings

PVS-Studio warning V507 for Pixie

Nov 19th, 2014
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. class CVariable {
  2. public:
  3.   char  name[64];  // Name as it is referenced
  4.   ...
  5. };
  6.  
  7. void CRendererContext::RiGeometryV(
  8.   char *type,int n,char *tokens[],void *params[])
  9. {
  10.   ...
  11.   } else {
  12.     CVariable var;
  13.     if (parseVariable(&var,NULL,tokens[i])) {
  14.       tokens[i] = var.name;
  15.       i--;
  16.     } else {
  17.       error(CODE_BADTOKEN,
  18.             "Unrecognised implicit parameter: %s\n",tokens[i]);
  19.     }
  20.   }
  21.   ...
  22. }
  23.  
  24. This suspicious code was found in Pixie project by PVS-Studio static code analyzer.
  25. Warning message is:
  26. V507 Pointer to local array 'var' is stored outside the scope of this array. Such a pointer will become invalid. ri renderer.cpp 5974
  27.  
  28. 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