summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pcre_compile.c22
-rw-r--r--pcre_study.c17
2 files changed, 18 insertions, 21 deletions
diff --git a/pcre_compile.c b/pcre_compile.c
index ac38484..0958039 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -1914,25 +1914,19 @@ for (;;)
/* Check a class for variable quantification */
-#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
- case OP_XCLASS:
-#endif
case OP_CLASS:
case OP_NCLASS:
-
- switch (op)
- {
#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
- case OP_XCLASS:
+ case OP_XCLASS:
+ /* The original code caused an unsigned overflow in 64 bit systems,
+ so now we use a conditional statement. */
+ if (op == OP_XCLASS)
cc += GET(cc, 1);
- break;
-#endif
-
- case OP_CLASS:
- case OP_NCLASS:
+ else
cc += PRIV(OP_lengths)[OP_CLASS];
- break;
- }
+#else
+ cc += PRIV(OP_lengths)[OP_CLASS];
+#endif
switch (*cc)
{
diff --git a/pcre_study.c b/pcre_study.c
index 9045185..2205dd7 100644
--- a/pcre_study.c
+++ b/pcre_study.c
@@ -323,16 +323,19 @@ for (;;)
/* Check a class for variable quantification */
-#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
- case OP_XCLASS:
- cc += GET(cc, 1);
- cc -= PRIV(OP_lengths)[OP_CLASS];
- /* Fall through */
-#endif
-
case OP_CLASS:
case OP_NCLASS:
+#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
+ case OP_XCLASS:
+ /* The original code caused an unsigned overflow in 64 bit systems,
+ so now we use a conditional statement. */
+ if (op == OP_XCLASS)
+ cc += GET(cc, 1);
+ else
+ cc += PRIV(OP_lengths)[OP_CLASS];
+#else
cc += PRIV(OP_lengths)[OP_CLASS];
+#endif
switch (*cc)
{