Advertisement
PVS-StudioWarnings

PVS-Studio warning V512 for MAME

Nov 24th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. UINT16      m_rotate_ctrl[8];
  2.  
  3. static MACHINE_RESET( wgp )
  4. {
  5.   wgp_state *state = machine.driver_data<wgp_state>();
  6.   int i;
  7.  
  8.   state->m_banknum = 0;
  9.   state->m_cpua_ctrl = 0xff;
  10.   state->m_port_sel = 0;
  11.   state->m_piv_ctrl_reg = 0;
  12.  
  13.   for (i = 0; i < 3; i++)
  14.   {
  15.     state->m_piv_zoom[i] = 0;
  16.     state->m_piv_scrollx[i] = 0;
  17.     state->m_piv_scrolly[i] = 0;
  18.   }
  19.  
  20.   memset(state->m_rotate_ctrl, 0, 8);
  21. }
  22.  
  23. This suspicious code was found in MAME project by PVS-Studio static code analyzer.
  24. Warning message is:
  25. V512 A call of the 'memset' function will lead to underflow of the buffer 'state->m_rotate_ctrl'.  wgp.c 949
  26.  
  27. 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