@@ -254,11 +254,17 @@ execute_lua(
254254
255255 // Execute 'varnish._ctx = ctx', 'varnish._script = script' and
256256 // 'varnish._state = state'.
257- lua_pushlightuserdata (engine -> ctx .L , (struct vrt_ctx * ) ctx );
257+ void * ptr_ctx = lua_newuserdata (engine -> ctx .L , sizeof (struct vrt_ctx * ));
258+ AN (ptr_ctx );
259+ * (const struct vrt_ctx * * )ptr_ctx = ctx ;
258260 lua_setfield (engine -> ctx .L , -4 , "_ctx" );
259- lua_pushlightuserdata (engine -> ctx .L , (struct vmod_cfg_script * ) script );
261+ void * ptr_script = lua_newuserdata (engine -> ctx .L , sizeof (struct vmod_cfg_script * ));
262+ AN (ptr_script );
263+ * (struct vmod_cfg_script * * )ptr_script = script ;
260264 lua_setfield (engine -> ctx .L , -4 , "_script" );
261- lua_pushlightuserdata (engine -> ctx .L , (task_state_t * ) state );
265+ void * ptr_state = lua_newuserdata (engine -> ctx .L , sizeof (task_state_t * ));
266+ AN (ptr_state );
267+ * (task_state_t * * )ptr_state = state ;
262268 lua_setfield (engine -> ctx .L , -4 , "_state" );
263269
264270 // Populate 'ARGV' table accordingly to the input arguments.
@@ -368,8 +374,10 @@ execute_lua(
368374 lua_getglobal(L, "varnish"); \
369375 AN(lua_istable(L, -1)); \
370376 lua_getfield(L, -1, field); \
371- AN(lua_islightuserdata(L, -1)); \
372- void *data = lua_touserdata(L, -1); \
377+ AN(lua_isuserdata(L, -1)); \
378+ void *ptr = lua_touserdata(L, -1); \
379+ AN(ptr); \
380+ void *data = *(void **)ptr; \
373381 AN(data); \
374382 CAST_OBJ_NOTNULL(where, data, MAGIC); \
375383 lua_pop(L, 2); \
0 commit comments