PVS-StudioWarnings

PVS-Studio warning V505 for MultiThreadSimpleQueue

Nov 20th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. COleDataSource* CGridCtrl::CopyTextFromGrid()
  2. {
  3.   ...
  4.   for (int row = Selection.GetMinRow();
  5.     row <= Selection.GetMaxRow(); row++)
  6.   {
  7.     ...
  8.     sf.Write(T2A(str.GetBuffer(1)), str.GetLength());
  9.     ...
  10.   }
  11.   ...
  12. }
  13.  
  14. This code is potentially dangerous. T2A() macro uses alloca() function. As alloca() function is called from within the loop, it can quickly lead to stack overflow.
  15.  
  16. This suspicious code was found in MultiThreadSimpleQueue project by PVS-Studio static code analyzer.
  17. Warning message is:
  18. V505 The 'alloca' function is used inside the loop. This can quickly overflow stack. GridCtrl  gridctrl.cpp  2332
  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