Advertisement
PVS-StudioWarnings

PVS-Studio warning V590 for FCEUX

Nov 25th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. bool Set_RS_Val()
  2. {
  3.   ...
  4.   int appliedSize = rs_type_size;
  5.   int appliedSign = rs_t;
  6.   if(rs_c == 'n')
  7.     appliedSize = 'w', appliedSign = 'u';
  8.   if(rs_c == 'a')
  9.     appliedSize = 'd', appliedSign = 'u';
  10.   if((appliedSize == 'b' && appliedSize == 's' &&
  11.      (rs_param < -128 || rs_param > 127)) ||
  12.      (appliedSize == 'b' && appliedSize != 's' &&
  13.      (rs_param < 0 || rs_param > 255)) ||
  14.      (appliedSize == 'w' && appliedSize == 's' &&
  15.      (rs_param < -32768 || rs_param > 32767)) ||
  16.      (appliedSize == 'w' && appliedSize != 's' &&
  17.      (rs_param < 0 || rs_param > 65535)))
  18.        return false;
  19.   ...
  20. }
  21.  
  22. This suspicious code was found in FCEUX project by PVS-Studio static code analyzer.
  23. Warning message is:
  24. V590 Consider inspecting the 'appliedSize == 'b' && appliedSize != 's'' expression. The expression is excessive or contains a misprint. fceux ram_search.cpp 877
  25.  
  26. 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