Advertisement
PVS-StudioWarnings

PVS-Studio warning V567 for nss

Nov 25th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. PK11SlotList *
  2. PK11_GetAllTokens(....)
  3. {
  4.   ....
  5.   int j = 0;
  6.   PRInt32 waste[16];
  7.   ....
  8. #if defined( XP_WIN32 )
  9.   /* This is works around some horrible cache/page thrashing
  10.   ** problems on Win32.  Without this, this loop can take up to
  11.   ** 6 seconds at 100% CPU on a Pentium-Pro 200.  The thing this
  12.   ** changes is to increase the size of the stack frame and
  13.   ** modify it. Moving the loop code itself seems to have no
  14.   ** effect. Dunno why this combination makes a difference,
  15.   ** but it does.
  16.   */
  17.   waste[j & 0xf] = j++;
  18. #endif
  19.   ....
  20. }
  21.  
  22. This suspicious code was found in nss project by PVS-Studio static code analyzer.
  23. Warning message is:
  24. V567 Undefined behavior. The 'j' variable is modified while being used twice between sequence points. pk11slot.c 1926
  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