PVS-StudioWarnings

PVS-Studio warning V557 for TrinityCore

Nov 17th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.20 KB | None | 0 0
  1. static struct wordvalue doubles[] = {
  2.  { "ch", (uchar*) "\014\031\057\057" },
  3.  { "Ch", (uchar*) "\014\031\060\060" },
  4.  { "CH", (uchar*) "\014\031\061\061" },
  5.  { "c",  (uchar*) "\005\012\021\021" },
  6.  { "C",  (uchar*) "\005\012\022\022" },
  7.  };
  8.  
  9. #define NEXT_CMP_VALUE(src, p, store, pass, value, len) \
  10. while (1)                                      \
  11. {                                              \
  12.   ......                                       \
  13.   for (i = 0; i < (int) sizeof(doubles); i++)  \
  14.   {                                            \
  15.     const char * pattern = doubles[i].word;    \
  16.     ...                                        \
  17.     }                                          \
  18.   }                                            \
  19.   ......                                       \
  20. }
  21.  
  22. An incorrect macro NEXT_CMP_VALUE.
  23.  
  24. This suspicious code was found in TrinityCore project by PVS-Studio static code analyzer.
  25. Warning message is:
  26. V557 Array overrun is possible. The value of 'i' index could reach 39. libmysql ctype-czech.c 260
  27.  
  28. 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