diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2014-04-21 16:11:50 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2014-04-21 16:11:50 +0000 |
commit | 08485470b2bfb9157d5d6f3e6a0b9e5b40583619 (patch) | |
tree | 0c53ee1ca9080b17ea38f4bcfb1ceb80c1d37727 | |
parent | bba7cd02f727e88c9169a8f70dd179b074be8e89 (diff) | |
download | pcre-08485470b2bfb9157d5d6f3e6a0b9e5b40583619.tar.gz |
Fix C++ compiler warnings and silly quantifier size check.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1472 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | pcre_compile.c | 35 | ||||
-rw-r--r-- | pcre_scanner_unittest.cc | 2 | ||||
-rw-r--r-- | pcre_stringpiece_unittest.cc | 2 | ||||
-rw-r--r-- | pcrecpp.cc | 4 | ||||
-rw-r--r-- | testdata/testoutput2 | 6 |
7 files changed, 41 insertions, 26 deletions
@@ -1,6 +1,18 @@ ChangeLog for PCRE ------------------ +Version 8.36 xx-xxx-2014 +------------------------ + +1. Got rid of some compiler warnings in the C++ modules that were shown up by + -Wmissing-field-initializers and -Wunused-parameter. + +2. The tests for quantifiers being too big (greater than 65535) were being + applied after reading the number, and stupidly assuming that integer + overflow would give a negative number. The tests are now applied as the + numbers are read. + + Version 8.35 04-April-2014 -------------------------- diff --git a/configure.ac b/configure.ac index aab2f56..142830a 100644 --- a/configure.ac +++ b/configure.ac @@ -9,9 +9,9 @@ dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might dnl be defined as -RC2, for example. For real releases, it should be empty. m4_define(pcre_major, [8]) -m4_define(pcre_minor, [35]) -m4_define(pcre_prerelease, []) -m4_define(pcre_date, [2014-04-04]) +m4_define(pcre_minor, [36]) +m4_define(pcre_prerelease, [-RC1]) +m4_define(pcre_date, [2014-04-21]) # NOTE: The CMakeLists.txt file searches for the above variables in the first # 50 lines of this file. Please update that if the variables above are moved. diff --git a/pcre_compile.c b/pcre_compile.c index 8a5b723..ae0027b 100644 --- a/pcre_compile.c +++ b/pcre_compile.c @@ -1583,30 +1583,30 @@ read_repeat_counts(const pcre_uchar *p, int *minp, int *maxp, int *errorcodeptr) int min = 0; int max = -1; -/* Read the minimum value and do a paranoid check: a negative value indicates -an integer overflow. */ - -while (IS_DIGIT(*p)) min = min * 10 + (int)(*p++ - CHAR_0); -if (min < 0 || min > 65535) +while (IS_DIGIT(*p)) { - *errorcodeptr = ERR5; - return p; - } - -/* Read the maximum value if there is one, and again do a paranoid on its size. -Also, max must not be less than min. */ + min = min * 10 + (int)(*p++ - CHAR_0); + if (min > 65535) + { + *errorcodeptr = ERR5; + return p; + } + } if (*p == CHAR_RIGHT_CURLY_BRACKET) max = min; else { if (*(++p) != CHAR_RIGHT_CURLY_BRACKET) { max = 0; - while(IS_DIGIT(*p)) max = max * 10 + (int)(*p++ - CHAR_0); - if (max < 0 || max > 65535) + while(IS_DIGIT(*p)) { - *errorcodeptr = ERR5; - return p; - } + max = max * 10 + (int)(*p++ - CHAR_0); + if (max > 65535) + { + *errorcodeptr = ERR5; + return p; + } + } if (max < min) { *errorcodeptr = ERR4; @@ -1615,9 +1615,6 @@ if (*p == CHAR_RIGHT_CURLY_BRACKET) max = min; else } } -/* Fill in the required variables, and pass back the pointer to the terminating -'}'. */ - *minp = min; *maxp = max; return p; diff --git a/pcre_scanner_unittest.cc b/pcre_scanner_unittest.cc index 7de8d2e..adc33c1 100644 --- a/pcre_scanner_unittest.cc +++ b/pcre_scanner_unittest.cc @@ -149,6 +149,8 @@ static void TestBigComment() { // small stack size int main(int argc, char** argv) { + (void)argc; + (void)argv; TestScanner(); TestBigComment(); diff --git a/pcre_stringpiece_unittest.cc b/pcre_stringpiece_unittest.cc index c58e028..f758d63 100644 --- a/pcre_stringpiece_unittest.cc +++ b/pcre_stringpiece_unittest.cc @@ -142,6 +142,8 @@ static void CheckComparisonOperators() { } int main(int argc, char** argv) { + (void)argc; + (void)argv; CheckComparisonOperators(); CheckSTLComparator(); @@ -511,7 +511,7 @@ int RE::TryMatch(const StringPiece& text, return 0; } - pcre_extra extra = { 0, 0, 0, 0, 0, 0 }; + pcre_extra extra = { 0, 0, 0, 0, 0, 0, 0, 0 }; if (options_.match_limit() > 0) { extra.flags |= PCRE_EXTRA_MATCH_LIMIT; extra.match_limit = options_.match_limit(); @@ -660,6 +660,8 @@ int RE::NumberOfCapturingGroups() const { /***** Parsers for various types *****/ bool Arg::parse_null(const char* str, int n, void* dest) { + (void)str; + (void)n; // We fail if somebody asked us to store into a non-NULL void* pointer return (dest == NULL); } diff --git a/testdata/testoutput2 b/testdata/testoutput2 index b6da7df..cfb446e 100644 --- a/testdata/testoutput2 +++ b/testdata/testoutput2 @@ -5821,13 +5821,13 @@ No match No match /a{11111111111111111111}/I -Failed: number too big in {} quantifier at offset 22 +Failed: number too big in {} quantifier at offset 8 /(){64294967295}/I -Failed: number too big in {} quantifier at offset 14 +Failed: number too big in {} quantifier at offset 9 /(){2,4294967295}/I -Failed: number too big in {} quantifier at offset 15 +Failed: number too big in {} quantifier at offset 11 "(?i:a)(?i:b)(?i:c)(?i:d)(?i:e)(?i:f)(?i:g)(?i:h)(?i:i)(?i:j)(k)(?i:l)A\1B"I Capturing subpattern count = 1 |