PVS-StudioWarnings

PVS-Studio warning V505 for Crystalspace

Nov 12th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #define CS_ALLOC_STACK_ARRAY(type, var, size) \
  2.   type *var = (type *)alloca ((size) * sizeof (type))
  3.  
  4. void Scene::PropagateLight (....)
  5. {
  6.   ...
  7.   PortalRefArray::Iterator it =
  8.     sourceSector->allPortals.GetIterator ();
  9.   while (it.HasNext ())
  10.   {
  11.     ...
  12.     CS_ALLOC_STACK_ARRAY(csVector3,
  13.       tmpVertices, portal->worldVertices.GetSize ());
  14.     ...
  15.   }
  16. }
  17.  
  18. This suspicious code was found in Crystalspace project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V505 The 'alloca' function is used inside the loop. This can quickly overflow stack.  applighter2  scene.cpp  942
  21.  
  22. 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