You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by ka...@apache.org on 2009/05/01 19:27:35 UTC

svn commit: r770765 - in /tcl/rivet/trunk: ChangeLog src/apache-2/mod_rivet.c

Author: karl
Date: Fri May  1 17:27:35 2009
New Revision: 770765

URL: http://svn.apache.org/viewvc?rev=770765&view=rev
Log:
* Rename global request rec pointer from globalrr to rivet_panic_request_rec, 
  add rivet_panic_pool and rivet_panic_server_rec, grabbing those values from 
  Rivet initialization rather than request handling so that they are 
  initialized enough that Rivet_Panic can use them.  (Previously Rivet_Panic
  or Tcl_Panic at initialization time caused a null-pointer-dereference
  segmentation violation because no request was being served.

  In Rivet_Panic, avoid emitting the unparsed URI unless a request is
  being processed.

Modified:
    tcl/rivet/trunk/ChangeLog
    tcl/rivet/trunk/src/apache-2/mod_rivet.c

Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=770765&r1=770764&r2=770765&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Fri May  1 17:27:35 2009
@@ -1,3 +1,15 @@
+2009-05-01 Karl Lehenbauer <ka...@apache.org>
+    * Rename global request rec pointer from globalrr to 
+      rivet_panic_request_rec, add rivet_panic_pool and
+      rivet_panic_server_rec, grabbing those values from Rivet initialization
+      rather than request handling so that they are initialized enough that
+      Rivet_Panic can use them.  (Previously Rivet_Panic or Tcl_Panic at 
+      initialization time caused a null-pointer-dereference segmentation 
+      violation because no request was being served.
+
+      In Rivet_Panic, avoid emitting the unparsed URI unless a request is
+      being processed.
+
 2009-04-27 Karl Lehenbauer <ka...@apache.org>
 
     * src/apache-2/mod_rivet.c: In Rivet_SendContent, when checking to see

Modified: tcl/rivet/trunk/src/apache-2/mod_rivet.c
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/src/apache-2/mod_rivet.c?rev=770765&r1=770764&r2=770765&view=diff
==============================================================================
--- tcl/rivet/trunk/src/apache-2/mod_rivet.c (original)
+++ tcl/rivet/trunk/src/apache-2/mod_rivet.c Fri May  1 17:27:35 2009
@@ -58,7 +58,9 @@
 //module AP_MODULE_DECLARE_DATA rivet_module;
 
 /* This is used *only* in the PanicProc.  Otherwise, don't touch it! */
-static request_rec *globalrr;
+static request_rec *rivet_panic_request_rec = NULL;
+static apr_pool_t *rivet_panic_pool = NULL;
+static server_rec *rivet_panic_server_rec = NULL;
 
 /* Need some arbitrary non-NULL pointer which can't also be a request_rec */
 #define NESTED_INCLUDE_MAGIC	(&rivet_module)
@@ -1071,6 +1073,9 @@
 Rivet_InitHandler(apr_pool_t *pPool, apr_pool_t *pLog, apr_pool_t *pTemp,
        server_rec *s)
 {
+    rivet_panic_pool = pPool;
+    rivet_panic_server_rec = s;
+
 #if RIVET_DISPLAY_VERSION
     ap_add_version_component(pPool, RIVET_PACKAGE_NAME"/"RIVET_PACKAGE_VERSION);
 #else
@@ -1216,10 +1221,17 @@
     char *format;
 
     format = (char *) TCL_VARARGS_START(char *,arg1,argList);
-    buf = (char *) apr_pvsprintf(globalrr->pool, format, argList);
-    ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EGENERAL, globalrr->server,
-		 "Critical error in request: %s", globalrr->unparsed_uri);
-    ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EGENERAL, globalrr->server, buf);
+    buf = (char *) apr_pvsprintf(rivet_panic_pool, format, argList);
+
+    if (rivet_panic_request_rec != NULL) {
+	ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EGENERAL, 
+		 rivet_panic_server_rec,
+		 "Critical error in request: %s", 
+		 rivet_panic_request_rec->unparsed_uri);
+    }
+
+    ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EGENERAL, 
+		 rivet_panic_server_rec, buf);
 
     abort();
 }
@@ -1467,6 +1479,8 @@
 static void
 Rivet_ChildInit(apr_pool_t *pChild, server_rec *s)
 {
+    ap_assert (s != (server_rec *)NULL);
+
     Rivet_InitTclStuff(s, pChild);
     Rivet_ChildHandlers(s, 1);
 
@@ -1501,7 +1515,7 @@
 
     /* Set the global request req to know what we are dealing with in
      * case we have to call the PanicProc. */
-    globalrr = r;
+    rivet_panic_request_rec = r;
 
     rsc = Rivet_GetConf(r);
     interp = rsc->server_interp;



---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-cvs-help@tcl.apache.org