From 5e8b28b6df4f795af92c5d60ea60d7e94aa357a2 Mon Sep 17 00:00:00 2001 From: ph10 Date: Wed, 7 Dec 2011 16:52:34 +0000 Subject: 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 --- ChangeLog | 3 +++ pcre_compile.c | 2 +- testdata/testoutput10 | 6 +++--- 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(?Pb|c)d(?Pe)/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(?Pc(?Pd)))(?Pa)/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 ------------------------------------------------------------------ /(?Pa)...(?P=a)bbb(?P>a)d/BM -Memory allocation (code space): 37 +Memory allocation (code space): 34 ------------------------------------------------------------------ 0 30 Bra 3 7 CBra 1 -- cgit v1.2.1