summaryrefslogtreecommitdiff
path: root/pcre_compile.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2015-02-08 16:43:13 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2015-02-08 16:43:13 +0000
commit46465068f53358d3ae6cca4d9db8d1ed3b9f1928 (patch)
treed961e11b5ea94e726452a145c2e42f350c0c4c3d /pcre_compile.c
parent0da83661b7dc75a64ba01061393ebb43806cee86 (diff)
downloadpcre-46465068f53358d3ae6cca4d9db8d1ed3b9f1928.tar.gz
Fix duplicate names memory calculation error.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1521 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_compile.c')
-rw-r--r--pcre_compile.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/pcre_compile.c b/pcre_compile.c
index bb8a5d0..109efbd 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -6734,8 +6734,7 @@ for (;; ptr++)
ptr++;
}
namelen = (int)(ptr - name);
- if (lengthptr != NULL && (options & PCRE_DUPNAMES) != 0)
- *lengthptr += IMM2_SIZE;
+ if (lengthptr != NULL) *lengthptr += IMM2_SIZE;
}
/* Check the terminator */
@@ -7152,11 +7151,11 @@ for (;; ptr++)
if (!is_recurse) cd->namedrefcount++;
- /* If duplicate names are permitted, we have to allow for a named
- reference to a duplicated name (this cannot be determined until the
- second pass). This needs an extra 16-bit data item. */
+ /* We have to allow for a named reference to a duplicated name (this
+ cannot be determined until the second pass). This needs an extra
+ 16-bit data item. */
- if ((options & PCRE_DUPNAMES) != 0) *lengthptr += IMM2_SIZE;
+ *lengthptr += IMM2_SIZE;
}
/* In the real compile, search the name table. We check the name
@@ -9156,13 +9155,6 @@ if (length > MAX_PATTERN_SIZE)
goto PCRE_EARLY_ERROR_RETURN;
}
-/* If there are groups with duplicate names and there are also references by
-name, we must allow for the possibility of named references to duplicated
-groups. These require an extra data item each. */
-
-if (cd->dupnames && cd->namedrefcount > 0)
- length += cd->namedrefcount * IMM2_SIZE * sizeof(pcre_uchar);
-
/* Compute the size of the data block for storing the compiled pattern. Integer
overflow should no longer be possible because nowadays we limit the maximum
value of cd->names_found and cd->name_entry_size. */