PVS-StudioWarnings

PVS-Studio warning V557 for QT

Nov 13th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.97 KB | None | 0 0
  1. static const JoiningPair joining_table[5][4] = { .... };
  2.  
  3. typedef enum {
  4.     JNone,
  5.     JCausing,
  6.     JDual,
  7.     JRight,
  8.     JTransparent
  9. } Joining;
  10.  
  11. static Joining getNkoJoining(unsigned short uc)
  12. {
  13.     if (uc < 0x7ca)
  14.         return JNone;
  15.     if (uc <= 0x7ea)
  16.         return JDual;
  17.     if (uc <= 0x7f3)
  18.         return JTransparent;
  19.     if (uc <= 0x7f9)
  20.         return JNone;
  21.     if (uc == 0x7fa)
  22.         return JCausing;
  23.     return JNone;
  24. }
  25.  
  26. static void getNkoProperties(....)
  27. {
  28.   ....
  29.   Joining j = getNkoJoining(chars[0]);
  30.   ArabicShape shape = joining_table[XIsolated][j].form2;
  31.   ....
  32. }
  33.  
  34. This suspicious code was found in QT project by PVS-Studio static code analyzer.
  35. Warning message is:
  36. V557 Array overrun is possible. The value of 'j' index could reach 4. harfbuzz-arabic.c 516
  37.  
  38. 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