Advertisement
PVS-StudioWarnings

PVS-Studio warning V512 for GameMusicEmu

Nov 24th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. struct header_t
  2. {
  3.   ...
  4.   byte load_addr [2];
  5.   byte init_addr [2];
  6.   byte play_addr [2];
  7.   ...
  8. }
  9.  
  10. blargg_err_t Nsfe_Info::load( Data_Reader& in,
  11.                               Nsf_Emu* nsf_emu )
  12. {
  13.   ...
  14.   memcpy( info.load_addr, finfo.load_addr, 2 * 3 );
  15.   ...
  16. }
  17.  
  18. There's no error, but this code is dangerous.
  19.  
  20. This suspicious code was found in GameMusicEmu project by PVS-Studio static code analyzer.
  21. Warning message is:
  22. V512 A call of the 'memcpy' function will lead to a buffer overflow or underflow. game-music-emu nsfe_emu.cpp 162
  23.  
  24. 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