Advertisement
PVS-StudioWarnings

PVS-Studio warning V557 for MTASA

Nov 27th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #define CORE_MTA_NEWS_ITEMS 3
  2.  
  3. CGUILabel* m_pNewsItemLabels[CORE_MTA_NEWS_ITEMS];
  4. CGUILabel* m_pNewsItemShadowLabels[CORE_MTA_NEWS_ITEMS];
  5.  
  6. void CMainMenu::SetNewsHeadline (....)
  7. {
  8.   ....
  9.   for ( char i=0; i <= CORE_MTA_NEWS_ITEMS; i++ )
  10.   {
  11.     m_pNewsItemLabels[ i ]->SetFont ( szFontName );
  12.     m_pNewsItemShadowLabels[ i ]->SetFont ( szFontName );
  13.     ....
  14.   }
  15.   ....
  16. }
  17.  
  18. This suspicious code was found in MTASA project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V557 Array overrun is possible. The value of 'i' index could reach 3. cmainmenu.cpp 1062
  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
Advertisement