]> granicus.if.org Git - apache/commitdiff
Change prototype of vm_construct, to work around gcc bug which
authorStefan Fritsch <sf@apache.org>
Sat, 16 Jun 2012 22:38:58 +0000 (22:38 +0000)
committerStefan Fritsch <sf@apache.org>
Sat, 16 Jun 2012 22:38:58 +0000 (22:38 +0000)
causes a segfault.

PR: 52779
Submitted by: Dick Snippe <Dick Snippe tech omroep nl>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1351012 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/lua/lua_vmprep.c

diff --git a/CHANGES b/CHANGES
index b4c20abc7c838e7cf38e5e3ff8b6e8058509a758..1fdfecd8a1ef725ae48bc4f6f07108ba0022f3a0 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,9 @@ Changes with Apache 2.5.0
      possible XSS for a site where untrusted users can upload files to
      a location with MultiViews enabled. [Niels Heinen <heinenn google.com>]
 
+  *) mod_lua: Change prototype of vm_construct, to work around gcc bug which
+     causes a segfault. PR 52779. [Dick Snippe <Dick Snippe tech omroep nl>]
+
   *) mod_ssl: If exiting during initialization because of a fatal error,
      log a message to the main error log pointing to the appropriate
      virtual host error log. [Stefan Fritsch]
index 1ffe5e2559100f43d8b46c23dade406a1cad5bec..1f7d0a37f7ffc0499a60f984016245ad11c480c0 100644 (file)
@@ -240,6 +240,7 @@ AP_LUA_DECLARE(void) ap_lua_load_apache2_lmodule(lua_State *L)
 /* callback for cleaning up a lua vm when pool is closed */
 static apr_status_t cleanup_lua(void *l)
 {
+    AP_DEBUG_ASSERT(l != NULL);
     lua_close((lua_State *) l);
     return APR_SUCCESS;
 }
@@ -319,7 +320,7 @@ static int loadjitmodule(lua_State *L, apr_pool_t *lifecycle_pool) {
 
 #endif
 
-static apr_status_t vm_construct(void **vm, void *params, apr_pool_t *lifecycle_pool)
+static apr_status_t vm_construct(lua_State **vm, void *params, apr_pool_t *lifecycle_pool)
 {
     lua_State* L;
 
@@ -393,7 +394,8 @@ AP_LUA_DECLARE(lua_State*)ap_lua_get_lua_state(apr_pool_t *lifecycle_pool,
                       "creating lua_State with file %s", spec->file);
         /* not available, so create */
         
-        if(!vm_construct((void **)&L, spec, lifecycle_pool)) {
+        if(!vm_construct(&L, spec, lifecycle_pool)) {
+          AP_DEBUG_ASSERT(L != NULL);
           apr_pool_userdata_set(L, 
                                 spec->file, 
                                 cleanup_lua,