[Pcre-svn] [1147] code/trunk/pcre_compile.c: Fix overflow by…

Kezdőlap
Üzenet törlése
Szerző: Subversion repository
Dátum:  
Címzett: pcre-svn
Tárgy: [Pcre-svn] [1147] code/trunk/pcre_compile.c: Fix overflow by unsigned conversion
Revision: 1147
          http://vcs.pcre.org/viewvc?view=rev&revision=1147
Author:   chpe
Date:     2012-10-20 21:17:03 +0100 (Sat, 20 Oct 2012)


Log Message:
-----------
Fix overflow by unsigned conversion

Similar to rev 1146.

Revision Links:
--------------
    http://vcs.pcre.org/viewvc?view=rev&revision=1146


Modified Paths:
--------------
    code/trunk/pcre_compile.c


Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2012-10-20 16:45:33 UTC (rev 1146)
+++ code/trunk/pcre_compile.c    2012-10-20 20:17:03 UTC (rev 1147)
@@ -1916,14 +1916,24 @@


 #if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
     case OP_XCLASS:
-    cc += GET(cc, 1) - PRIV(OP_lengths)[OP_CLASS];
-    /* Fall through */
 #endif
-
     case OP_CLASS:
     case OP_NCLASS:
-    cc += PRIV(OP_lengths)[OP_CLASS];


+    switch (op)
+      {
+#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
+      case OP_XCLASS:
+      cc += GET(cc, 1);
+      break;
+#endif
+
+      case OP_CLASS:
+      case OP_NCLASS:
+      cc += PRIV(OP_lengths)[OP_CLASS];
+      break;
+      }
+
     switch (*cc)
       {
       case OP_CRPLUS: