From ca02d628a6dcbe2e16dce8bcb88b4ce41cceb0f8 Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Sat, 16 Jun 2012 22:38:58 +0000 Subject: [PATCH] Change prototype of vm_construct, to work around gcc bug which causes a segfault. PR: 52779 Submitted by: Dick Snippe git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1351012 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ modules/lua/lua_vmprep.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index b4c20abc7c8..1fdfecd8a1e 100644 --- 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 ] + *) mod_lua: Change prototype of vm_construct, to work around gcc bug which + causes a segfault. PR 52779. [Dick Snippe ] + *) 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] diff --git a/modules/lua/lua_vmprep.c b/modules/lua/lua_vmprep.c index 1ffe5e25591..1f7d0a37f7f 100644 --- a/modules/lua/lua_vmprep.c +++ b/modules/lua/lua_vmprep.c @@ -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, -- 2.47.2