summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-12-07 16:52:34 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-12-07 16:52:34 +0000
commit5e8b28b6df4f795af92c5d60ea60d7e94aa357a2 (patch)
treee70f678d229b4e0b7fc9f394dd54cb0428552a11
parent39336d4ddf36c07d131429715ad809074d0bb938 (diff)
downloadpcre-5e8b28b6df4f795af92c5d60ea60d7e94aa357a2.tar.gz
Computation of memory needed for the table of names of groups was giving an
unnecessarily large value. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@793 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog3
-rw-r--r--pcre_compile.c2
-rw-r--r--testdata/testoutput106
3 files changed, 7 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index fc0d82b..d2b7dc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -113,6 +113,9 @@ Version 8.21 05-Dec-2011
28. Fixed a possible uninitialized memory bug in pcre_jit_compile.c.
+29. Computation of memory usage for the table of capturing group names was
+ giving an unnecessarily large value.
+
Version 8.20 21-Oct-2011
------------------------
diff --git a/pcre_compile.c b/pcre_compile.c
index 568816d..ca07db1 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -7543,7 +7543,7 @@ externally provided function. Integer overflow should no longer be possible
because nowadays we limit the maximum value of cd->names_found and
cd->name_entry_size. */
-size = length + sizeof(real_pcre) + cd->names_found * (cd->name_entry_size + 3);
+size = length + sizeof(real_pcre) + cd->names_found * cd->name_entry_size;
re = (real_pcre *)(pcre_malloc)(size);
if (re == NULL)
diff --git a/testdata/testoutput10 b/testdata/testoutput10
index f66a12a..2e968fc 100644
--- a/testdata/testoutput10
+++ b/testdata/testoutput10
@@ -194,7 +194,7 @@ Memory allocation (code space): 28
------------------------------------------------------------------
/a(?P<name1>b|c)d(?P<longername2>e)/BM
-Memory allocation (code space): 42
+Memory allocation (code space): 36
------------------------------------------------------------------
0 32 Bra
3 a
@@ -212,7 +212,7 @@ Memory allocation (code space): 42
------------------------------------------------------------------
/(?:a(?P<c>c(?P<d>d)))(?P<a>a)/BM
-Memory allocation (code space): 54
+Memory allocation (code space): 45
------------------------------------------------------------------
0 41 Bra
3 25 Bra
@@ -232,7 +232,7 @@ Memory allocation (code space): 54
------------------------------------------------------------------
/(?P<a>a)...(?P=a)bbb(?P>a)d/BM
-Memory allocation (code space): 37
+Memory allocation (code space): 34
------------------------------------------------------------------
0 30 Bra
3 7 CBra 1