httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1418930 - in /httpd/httpd/branches/2.4.x: ./ CHANGES STATUS configure.in server/util.c server/util_pcre.c
Date Sun, 09 Dec 2012 13:10:48 GMT
Author: sf
Date: Sun Dec  9 13:10:46 2012
New Revision: 1418930

URL: http://svn.apache.org/viewvc?rev=1418930&view=rev
Log:
Merge r1343109:

    Make ap_regcomp() return AP_REG_ESPACE if out of memory.  Make ap_pregcomp()
    abort if out of memory.
    
    This raises the minimum PCRE requirement to version 6.0, released in 2005.

Reviewed by: jim, sf, minfrin


Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/configure.in
    httpd/httpd/branches/2.4.x/server/util.c
    httpd/httpd/branches/2.4.x/server/util_pcre.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1343109

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1418930&r1=1418929&r2=1418930&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Sun Dec  9 13:10:46 2012
@@ -2,6 +2,10 @@
 
 Changes with Apache 2.4.4
 
+  *) core: Make ap_regcomp() return AP_REG_ESPACE if out of memory.  Make
+     ap_pregcomp() abort if out of memory. This raises the minimum PCRE
+     requirement to version 6.0. [Stefan Fritsch]
+
   *) mod_proxy: Add ability to configure the sticky session separator.
      PR 53893. [<inu inusasha de>, Jim Jagielski]
 

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1418930&r1=1418929&r2=1418930&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Sun Dec  9 13:10:46 2012
@@ -91,13 +91,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * core: Make ap_regcomp() return AP_REG_ESPACE if out of memory.
-     Make ap_pregcomp() abort if out of memory. This raises the minimum
-     PCRE requirement to version 6.0, released in 2005.
-     trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1343109
-     2.4.x patch: trunk patch works
-     +1: jim, sf, minfrin
-
    * util: make varbuf functions treat AP_VARBUF_UNKNOWN consistently
      trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1359884
      2.4.x patch: trunk patch works

Modified: httpd/httpd/branches/2.4.x/configure.in
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/configure.in?rev=1418930&r1=1418929&r2=1418930&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/configure.in (original)
+++ httpd/httpd/branches/2.4.x/configure.in Sun Dec  9 13:10:46 2012
@@ -226,6 +226,11 @@ if test "$PCRE_CONFIG" != "false"; then
   if $PCRE_CONFIG --version >/dev/null 2>&1; then :; else
     AC_MSG_ERROR([Did not find pcre-config script at $PCRE_CONFIG])
   fi
+  case `$PCRE_CONFIG --version` in
+  [[1-5].*])
+    AC_MSG_ERROR([Need at least pcre version 6.0])
+    ;;
+  esac
   AC_MSG_NOTICE([Using external PCRE library from $PCRE_CONFIG])
   APR_ADDTO(PCRE_INCLUDES, [`$PCRE_CONFIG --cflags`])
   APR_ADDTO(PCRE_LIBS, [`$PCRE_CONFIG --libs`])

Modified: httpd/httpd/branches/2.4.x/server/util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/util.c?rev=1418930&r1=1418929&r2=1418930&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/util.c (original)
+++ httpd/httpd/branches/2.4.x/server/util.c Sun Dec  9 13:10:46 2012
@@ -278,8 +278,10 @@ AP_DECLARE(ap_regex_t *) ap_pregcomp(apr
                                      int cflags)
 {
     ap_regex_t *preg = apr_palloc(p, sizeof *preg);
-
-    if (ap_regcomp(preg, pattern, cflags)) {
+    int err = ap_regcomp(preg, pattern, cflags);
+    if (err) {
+        if (err == AP_REG_ESPACE)
+            ap_abort_on_oom();
         return NULL;
     }
 

Modified: httpd/httpd/branches/2.4.x/server/util_pcre.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/util_pcre.c?rev=1418930&r1=1418929&r2=1418930&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/util_pcre.c (original)
+++ httpd/httpd/branches/2.4.x/server/util_pcre.c Sun Dec  9 13:10:46 2012
@@ -123,6 +123,7 @@ AP_DECLARE(int) ap_regcomp(ap_regex_t * 
 {
     const char *errorptr;
     int erroffset;
+    int errcode = 0;
     int options = 0;
 
     if ((cflags & AP_REG_ICASE) != 0)
@@ -133,11 +134,18 @@ AP_DECLARE(int) ap_regcomp(ap_regex_t * 
         options |= PCRE_DOTALL;
 
     preg->re_pcre =
-        pcre_compile(pattern, options, &errorptr, &erroffset, NULL);
+        pcre_compile2(pattern, options, &errcode, &errorptr, &erroffset, NULL);
     preg->re_erroffset = erroffset;
 
-    if (preg->re_pcre == NULL)
+    if (preg->re_pcre == NULL) {
+        /*
+         * There doesn't seem to be constants defined for compile time error
+         * codes. 21 is "failed to get memory" according to pcreapi(3).
+         */
+        if (errcode == 21)
+            return AP_REG_ESPACE;
         return AP_REG_INVARG;
+    }
 
     pcre_fullinfo((const pcre *)preg->re_pcre, NULL,
                    PCRE_INFO_CAPTURECOUNT, &(preg->re_nsub));



Mime
View raw message