[Pcre-svn] [418] code/trunk: Fix POSIX error code bug.

Página Inicial
Delete this message
Autor: Subversion repository
Data:  
Para: pcre-svn
Assunto: [Pcre-svn] [418] code/trunk: Fix POSIX error code bug.
Revision: 418
          http://vcs.pcre.org/viewvc?view=rev&revision=418
Author:   ph10
Date:     2009-04-24 10:17:18 +0100 (Fri, 24 Apr 2009)


Log Message:
-----------
Fix POSIX error code bug.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/configure.ac
    code/trunk/pcreposix.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2009-04-11 16:44:43 UTC (rev 417)
+++ code/trunk/ChangeLog    2009-04-24 09:17:18 UTC (rev 418)
@@ -1,6 +1,15 @@
 ChangeLog for PCRE
 ------------------


+Version 8.00 ??-???-??
+----------------------
+
+1.  The table for translating pcre_compile() error codes into POSIX error codes
+    was out-of-date, and there was no check on the pcre_compile() error code 
+    being within the table. This could lead to an OK return being given in 
+    error.
+
+
 Version 7.9 11-Apr-09
 ---------------------



Modified: code/trunk/configure.ac
===================================================================
--- code/trunk/configure.ac    2009-04-11 16:44:43 UTC (rev 417)
+++ code/trunk/configure.ac    2009-04-24 09:17:18 UTC (rev 418)
@@ -6,10 +6,10 @@
 dnl be defined as -RC2, for example. For real releases, it should be defined
 dnl empty.


-m4_define(pcre_major, [7])
-m4_define(pcre_minor, [9])
-m4_define(pcre_prerelease, [])
-m4_define(pcre_date, [2009-04-11])
+m4_define(pcre_major, [8])
+m4_define(pcre_minor, [00])
+m4_define(pcre_prerelease, [-RC1])
+m4_define(pcre_date, [2009-04-23])

# Libtool shared library interface versions (current:revision:age)
m4_define(libpcre_version, [0:1:0])

Modified: code/trunk/pcreposix.c
===================================================================
--- code/trunk/pcreposix.c    2009-04-11 16:44:43 UTC (rev 417)
+++ code/trunk/pcreposix.c    2009-04-24 09:17:18 UTC (rev 418)
@@ -70,60 +70,74 @@
   REG_EESCAPE, /* \c at end of pattern */
   REG_EESCAPE, /* unrecognized character follows \ */
   REG_BADBR,   /* numbers out of order in {} quantifier */
+  /* 5 */ 
   REG_BADBR,   /* number too big in {} quantifier */
   REG_EBRACK,  /* missing terminating ] for character class */
   REG_ECTYPE,  /* invalid escape sequence in character class */
   REG_ERANGE,  /* range out of order in character class */
   REG_BADRPT,  /* nothing to repeat */
+  /* 10 */ 
   REG_BADRPT,  /* operand of unlimited repeat could match the empty string */
   REG_ASSERT,  /* internal error: unexpected repeat */
   REG_BADPAT,  /* unrecognized character after (? */
   REG_BADPAT,  /* POSIX named classes are supported only within a class */
   REG_EPAREN,  /* missing ) */
+  /* 15 */ 
   REG_ESUBREG, /* reference to non-existent subpattern */
   REG_INVARG,  /* erroffset passed as NULL */
   REG_INVARG,  /* unknown option bit(s) set */
   REG_EPAREN,  /* missing ) after comment */
   REG_ESIZE,   /* parentheses nested too deeply */
+  /* 20 */ 
   REG_ESIZE,   /* regular expression too large */
   REG_ESPACE,  /* failed to get memory */
-  REG_EPAREN,  /* unmatched brackets */
+  REG_EPAREN,  /* unmatched parentheses */
   REG_ASSERT,  /* internal error: code overflow */
   REG_BADPAT,  /* unrecognized character after (?< */
+  /* 25 */ 
   REG_BADPAT,  /* lookbehind assertion is not fixed length */
   REG_BADPAT,  /* malformed number or name after (?( */
   REG_BADPAT,  /* conditional group contains more than two branches */
   REG_BADPAT,  /* assertion expected after (?( */
   REG_BADPAT,  /* (?R or (?[+-]digits must be followed by ) */
+  /* 30 */ 
   REG_ECTYPE,  /* unknown POSIX class name */
   REG_BADPAT,  /* POSIX collating elements are not supported */
   REG_INVARG,  /* this version of PCRE is not compiled with PCRE_UTF8 support */
   REG_BADPAT,  /* spare error */
   REG_BADPAT,  /* character value in \x{...} sequence is too large */
+  /* 35 */ 
   REG_BADPAT,  /* invalid condition (?(0) */
   REG_BADPAT,  /* \C not allowed in lookbehind assertion */
   REG_EESCAPE, /* PCRE does not support \L, \l, \N, \U, or \u */
   REG_BADPAT,  /* number after (?C is > 255 */
   REG_BADPAT,  /* closing ) for (?C expected */
+  /* 40 */ 
   REG_BADPAT,  /* recursive call could loop indefinitely */
   REG_BADPAT,  /* unrecognized character after (?P */
   REG_BADPAT,  /* syntax error in subpattern name (missing terminator) */
   REG_BADPAT,  /* two named subpatterns have the same name */
   REG_BADPAT,  /* invalid UTF-8 string */
+  /* 45 */ 
   REG_BADPAT,  /* support for \P, \p, and \X has not been compiled */
   REG_BADPAT,  /* malformed \P or \p sequence */
   REG_BADPAT,  /* unknown property name after \P or \p */
   REG_BADPAT,  /* subpattern name is too long (maximum 32 characters) */
   REG_BADPAT,  /* too many named subpatterns (maximum 10,000) */
+  /* 50 */ 
   REG_BADPAT,  /* repeated subpattern is too long */
   REG_BADPAT,  /* octal value is greater than \377 (not in UTF-8 mode) */
   REG_BADPAT,  /* internal error: overran compiling workspace */
   REG_BADPAT,  /* internal error: previously-checked referenced subpattern not found */
   REG_BADPAT,  /* DEFINE group contains more than one branch */
+  /* 55 */ 
   REG_BADPAT,  /* repeating a DEFINE group is not allowed */
   REG_INVARG,  /* inconsistent NEWLINE options */
   REG_BADPAT,  /* \g is not followed followed by an (optionally braced) non-zero number */
-  REG_BADPAT,  /* (?+ or (?- must be followed by a non-zero number */
+  REG_BADPAT,  /* a numbered reference must not be zero */
+  REG_BADPAT,  /* (*VERB) with an argument is not supported */
+  /* 60 */
+  REG_BADPAT,  /* (*VERB) not recognized */ 
   REG_BADPAT,  /* number is too big */
   REG_BADPAT,  /* subpattern name expected */
   REG_BADPAT,  /* digit expected after (?+ */
@@ -236,8 +250,15 @@
   &erroffset, NULL);
 preg->re_erroffset = erroffset;


-if (preg->re_pcre == NULL) return eint[errorcode];
+/* Safety: if the error code is too big for the translation vector (which
+should not happen, but we all make mistakes), return REG_BADPAT. */

+if (preg->re_pcre == NULL) 
+  {
+  return (errorcode < sizeof(eint)/sizeof(const int))?
+    eint[errorcode] : REG_BADPAT;
+  } 
+
 preg->re_nsub = pcre_info((const pcre *)preg->re_pcre, NULL, NULL);
 return 0;
 }