diff -Nru php-luasandbox-3.0.1/CREDITS php-luasandbox-3.0.3/CREDITS --- php-luasandbox-3.0.1/CREDITS 2018-02-28 18:56:42.000000000 +0000 +++ php-luasandbox-3.0.3/CREDITS 2018-10-11 02:06:41.000000000 +0000 @@ -1 +1,6 @@ -luasandbox \ No newline at end of file +;; luasandbox +Tim Starling [tstarling] (lead) +Brad Jorsch +Kunal Mehta +Victor Vasiliev +Ori Livneh diff -Nru php-luasandbox-3.0.1/debian/changelog php-luasandbox-3.0.3/debian/changelog --- php-luasandbox-3.0.1/debian/changelog 2018-03-06 07:15:52.000000000 +0000 +++ php-luasandbox-3.0.3/debian/changelog 2018-10-13 05:15:59.000000000 +0000 @@ -1,3 +1,36 @@ +php-luasandbox (3.0.3-1ppa1~xenial1) xenial; urgency=medium + + * Rebuild for xenial. + + -- Kunal Mehta Fri, 12 Oct 2018 22:15:59 -0700 + +php-luasandbox (3.0.3-1~bpo9+1) stretch-backports; urgency=medium + + * Rebuild for stretch-backports. + + -- Kunal Mehta Fri, 12 Oct 2018 22:12:12 -0700 + +php-luasandbox (3.0.3-1) unstable; urgency=medium + + * New upstream version 3.0.3 + * d/watch: Enable pgpmode=gittag + * Standards-Version: 4.2.1, no changes needed + + -- Kunal Mehta Wed, 10 Oct 2018 21:41:00 -0700 + +php-luasandbox (3.0.1-2~bpo9+1) stretch-backports; urgency=medium + + * Rebuild for stretch-backports. + + -- Kunal Mehta Thu, 10 May 2018 15:16:11 -0700 + +php-luasandbox (3.0.1-2) unstable; urgency=medium + + * Switch Maintainer to "MediaWiki packaging team" + * Standards-Version: 4.1.4 + + -- Kunal Mehta Sun, 06 May 2018 23:17:05 -0700 + php-luasandbox (3.0.1-1ppa1~xenial1) xenial; urgency=medium * Rebuild for xenial. diff -Nru php-luasandbox-3.0.1/debian/control php-luasandbox-3.0.3/debian/control --- php-luasandbox-3.0.1/debian/control 2018-03-06 07:13:15.000000000 +0000 +++ php-luasandbox-3.0.3/debian/control 2018-10-13 05:15:59.000000000 +0000 @@ -1,13 +1,14 @@ Source: php-luasandbox Section: php Priority: optional -Maintainer: Kunal Mehta +Maintainer: MediaWiki packaging team +Uploaders: Kunal Mehta Build-Depends: debhelper (>= 10), dh-php, liblua5.1-0-dev, pkg-config, php-dev -Standards-Version: 4.1.3 +Standards-Version: 4.2.1 Homepage: https://www.mediawiki.org/wiki/LuaSandbox Vcs-Git: https://salsa.debian.org/mediawiki-team/php-luasandbox.git Vcs-Browser: https://salsa.debian.org/mediawiki-team/php-luasandbox diff -Nru php-luasandbox-3.0.1/debian/source/lintian-overrides php-luasandbox-3.0.3/debian/source/lintian-overrides --- php-luasandbox-3.0.1/debian/source/lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ php-luasandbox-3.0.3/debian/source/lintian-overrides 2018-10-13 05:15:46.000000000 +0000 @@ -0,0 +1,2 @@ +# not needed +php-luasandbox source: pear-package-without-pkg-php-tools-builddep diff -Nru php-luasandbox-3.0.1/debian/upstream/signing-key.asc php-luasandbox-3.0.3/debian/upstream/signing-key.asc --- php-luasandbox-3.0.1/debian/upstream/signing-key.asc 1970-01-01 00:00:00.000000000 +0000 +++ php-luasandbox-3.0.3/debian/upstream/signing-key.asc 2018-10-13 05:15:46.000000000 +0000 @@ -0,0 +1,51 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFRtO8oBEADIUo4XuMpVQWPKBhjovVNt8buSdUGuhZOYt4Nru3zRqWFyEhZQ +lHm+HmMDO6OXiuCiK3QBuzqQm2FSBdzEoFcQ9C+MELIyLDbFZ87smF4G27/sMrFz +wiiwRBxJ5AiF7ugcpjGetVoYlx1IpGfeA0wkZJiDkqgXafwqCuf9iwzp1Z9nl1FV +UkdJqG+2UHvhxM4PJg4SFLXcsZHwUaoFxuh2GhUREXPQ2TgyJ/SxMhLJdcpQFVLw +VoXkMLAVoEq8+VE+wtVWKEPOWqjhRmRHMuWOUASGukDq4sQQbtFwfRqtdCb4eU6t +JmiHc/ewhMUDc+B1AQt7z2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uyWTnAGA5ofgcXaDSwpJFIgtSOyqGyxeVv5ep/OWs/s +3u2O9j5CFP15OqSD68XdjGL9l6q9gFr3KW7sT91gEIfPSdNKNLrehg7Oixnw7deR +kBAC6p+9QELRUKlekgdWtrnxHSspWbh240JTGBu9LKpGCUan0Kmu7dig/7xpWTB0 +10C+wiUQpdmrqgdL7xi83hIB0+II4g4qA6teFAdFtwRwzTxs4jw8gvo9YCb9tyED +vfZFyO6rU3LzlOEP795XfcKdWdQq0sixmKAs7FueBegn55I+yeNQttKADO+gTJRj +GkmSQDsf3fI+DXySyjy+iCqBoMufng7gOy4U/2GTO/jnZTHFg6ZTEN0/QD6cb27o +99XU+X4uF88yfrYboYlQUwDsVD5fUJFZZjJ23/Gv/QdPbr2n2+CQM67gFs4jE3mA +oXfhvlyUNjmls1ovorr+REum3AUxKU9scDUT0uTGrKzBoOMavrOH8EbsjEp3oJsf +4S122Mcjn0OtGA/cGaRhBGo= +=WZF+ +-----END PGP PUBLIC KEY BLOCK----- diff -Nru php-luasandbox-3.0.1/debian/watch php-luasandbox-3.0.3/debian/watch --- php-luasandbox-3.0.1/debian/watch 2018-02-14 05:47:10.000000000 +0000 +++ php-luasandbox-3.0.3/debian/watch 2018-10-13 05:15:46.000000000 +0000 @@ -1,5 +1,5 @@ version=4 -opts="mode=git, pgpmode=none" \ +opts="mode=git, gitmode=full, pgpmode=gittag" \ https://gerrit.wikimedia.org/r/mediawiki/php/luasandbox \ refs/tags/([\d\.]+) debian uupdate diff -Nru php-luasandbox-3.0.1/luasandbox.c php-luasandbox-3.0.3/luasandbox.c --- php-luasandbox-3.0.1/luasandbox.c 2018-02-28 18:56:42.000000000 +0000 +++ php-luasandbox-3.0.3/luasandbox.c 2018-10-11 02:06:41.000000000 +0000 @@ -54,9 +54,9 @@ static int luasandbox_post_deactivate(); static object_constructor_ret_t luasandbox_new(zend_class_entry *ce TSRMLS_DC); static lua_State * luasandbox_newstate(php_luasandbox_obj * intern TSRMLS_DC); -static void luasandbox_free_storage(void *object TSRMLS_DC); +static void luasandbox_free_storage(zend_object *object TSRMLS_DC); static object_constructor_ret_t luasandboxfunction_new(zend_class_entry *ce TSRMLS_DC); -static void luasandboxfunction_free_storage(void *object TSRMLS_DC); +static void luasandboxfunction_free_storage(zend_object *object TSRMLS_DC); static int luasandbox_panic(lua_State * L); static lua_State * luasandbox_state_from_zval(zval * this_ptr TSRMLS_DC); static void luasandbox_load_helper(int binary, INTERNAL_FUNCTION_PARAMETERS); @@ -305,8 +305,10 @@ #if PHP_VERSION_ID >= 70000 memcpy(&luasandbox_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + luasandbox_object_handlers.offset = XtOffsetOf(php_luasandbox_obj, std); luasandbox_object_handlers.free_obj = (zend_object_free_obj_t)luasandbox_free_storage; memcpy(&luasandboxfunction_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + luasandboxfunction_object_handlers.offset = XtOffsetOf(php_luasandboxfunction_obj, std); luasandboxfunction_object_handlers.free_obj = (zend_object_free_obj_t)luasandboxfunction_free_storage; #endif @@ -380,8 +382,14 @@ php_luasandbox_obj * sandbox; // Create the internal object - sandbox = (php_luasandbox_obj*)emalloc(sizeof(php_luasandbox_obj)); - memset(sandbox, 0, sizeof(php_luasandbox_obj)); +#if PHP_VERSION_ID < 70000 + sandbox = (php_luasandbox_obj*)ecalloc(1, sizeof(php_luasandbox_obj)); +#elif PHP_VERSION_ID < 70300 + sandbox = (php_luasandbox_obj*)ecalloc(1, sizeof(php_luasandbox_obj) + zend_object_properties_size(ce)); +#else + sandbox = (php_luasandbox_obj*)zend_object_alloc(sizeof(php_luasandbox_obj), ce); +#endif + zend_object_std_init(&sandbox->std, ce TSRMLS_CC); #if PHP_VERSION_ID > 50399 object_properties_init(&sandbox->std, ce); @@ -452,9 +460,9 @@ * * "Free storage" handler for LuaSandbox objects. */ -static void luasandbox_free_storage(void *object TSRMLS_DC) +static void luasandbox_free_storage(zend_object *object TSRMLS_DC) { - php_luasandbox_obj * sandbox = (php_luasandbox_obj*)object; + php_luasandbox_obj * sandbox = php_luasandbox_fetch_object(object); luasandbox_timer_destroy(&sandbox->timer); if (sandbox->state) { @@ -478,8 +486,14 @@ php_luasandboxfunction_obj * intern; // Create the internal object - intern = (php_luasandboxfunction_obj*)emalloc(sizeof(php_luasandboxfunction_obj)); - memset(intern, 0, sizeof(php_luasandboxfunction_obj)); +#if PHP_VERSION_ID < 70000 + intern = (php_luasandboxfunction_obj*)ecalloc(1, sizeof(php_luasandboxfunction_obj)); +#elif PHP_VERSION_ID < 70300 + intern = (php_luasandboxfunction_obj*)ecalloc(1, sizeof(php_luasandboxfunction_obj) + zend_object_properties_size(ce)); +#else + intern = (php_luasandboxfunction_obj*)zend_object_alloc(sizeof(php_luasandboxfunction_obj), ce); +#endif + zend_object_std_init(&intern->std, ce TSRMLS_CC); #if PHP_VERSION_ID > 50399 object_properties_init(&intern->std, ce); @@ -508,9 +522,9 @@ * from the registry and decrements the reference counter for the parent * LuaSandbox object. */ -static void luasandboxfunction_free_storage(void *object TSRMLS_DC) +static void luasandboxfunction_free_storage(zend_object *object TSRMLS_DC) { - php_luasandboxfunction_obj * func = (php_luasandboxfunction_obj*)object; + php_luasandboxfunction_obj * func = php_luasandboxfunction_fetch_object(object); if (LUASANDBOXFUNCTION_SANDBOX_IS_OK(func)) { zval *zsandbox = LUASANDBOXFUNCTION_GET_SANDBOX_ZVALPTR(func); php_luasandbox_obj * sandbox = GET_LUASANDBOX_OBJ(zsandbox); @@ -592,7 +606,7 @@ php_luasandbox_obj * sandbox; zval *zthis; zval *return_value; -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 void ***tsrm_ls; #endif char *code; @@ -604,7 +618,7 @@ struct luasandbox_load_helper_params *p = (struct luasandbox_load_helper_params *)lua_touserdata(L, 1); int status; zval *return_value = p->return_value; -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 void ***tsrm_ls = p->tsrm_ls; #endif @@ -681,7 +695,7 @@ luasandbox_timer_unpause(&p.sandbox->timer); p.zthis = getThis(); -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 p.tsrm_ls = tsrm_ls; #endif p.return_value = return_value; @@ -754,7 +768,7 @@ static int luasandbox_safe_trace_to_zval(lua_State* L) { zval *zsandbox = (zval *)lua_touserdata(L, 2); zval *ztrace = (zval *)lua_touserdata(L, 3); -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 void ***tsrm_ls = (void ***)lua_touserdata(L, 4); #endif @@ -833,7 +847,7 @@ lua_pushlightuserdata(L, LUASANDBOX_GET_CURRENT_ZVAL_PTR(sandbox)); lua_pushlightuserdata(L, ztrace); lua_pushlightuserdata(L, -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 tsrm_ls #else NULL @@ -1258,7 +1272,7 @@ php_luasandbox_obj * sandbox; zval *zthis; zval *return_value; -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 void ***tsrm_ls; #endif char *name; @@ -1270,7 +1284,7 @@ static int LuaSandbox_callFunction_protected(lua_State* L) { struct LuaSandbox_callFunction_params *p = (struct LuaSandbox_callFunction_params *)lua_touserdata(L, 1); zval *return_value = p->return_value; -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 void ***tsrm_ls = p->tsrm_ls; #endif @@ -1308,7 +1322,7 @@ p.zthis = getThis(); p.return_value = return_value; -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 p.tsrm_ls = tsrm_ls; #endif status = lua_cpcall(L, LuaSandbox_callFunction_protected, &p); @@ -1343,7 +1357,7 @@ struct LuaSandbox_wrapPhpFunction_params { zval *zthis; zval *return_value; -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 void ***tsrm_ls; #endif zval *z; @@ -1352,7 +1366,7 @@ static int LuaSandbox_wrapPhpFunction_protected(lua_State* L) { struct LuaSandbox_wrapPhpFunction_params *p = (struct LuaSandbox_wrapPhpFunction_params *)lua_touserdata(L, 1); zval *return_value = p->return_value; -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 void ***tsrm_ls = p->tsrm_ls; #endif @@ -1390,7 +1404,7 @@ } p.return_value = return_value; -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 p.tsrm_ls = tsrm_ls; #endif status = lua_cpcall(L, LuaSandbox_wrapPhpFunction_protected, &p); @@ -1480,7 +1494,7 @@ struct LuaSandboxFunction_call_params { php_luasandbox_obj * sandbox; zval *return_value; -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 void ***tsrm_ls; #endif php_luasandboxfunction_obj *func; @@ -1491,7 +1505,7 @@ static int LuaSandboxFunction_call_protected(lua_State* L) { struct LuaSandboxFunction_call_params *p = (struct LuaSandboxFunction_call_params *)lua_touserdata(L, 1); zval *return_value = p->return_value; -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 void ***tsrm_ls = p->tsrm_ls; #endif @@ -1509,7 +1523,7 @@ int status; p.return_value = return_value; -#ifdef ZTS +#if defined(ZTS) && PHP_VERSION_ID < 70000 p.tsrm_ls = tsrm_ls; #endif p.numArgs = 0; diff -Nru php-luasandbox-3.0.1/luasandbox.php php-luasandbox-3.0.3/luasandbox.php --- php-luasandbox-3.0.1/luasandbox.php 2018-02-28 18:56:42.000000000 +0000 +++ php-luasandbox-3.0.3/luasandbox.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -"; - -if(!extension_loaded('luasandbox')) { - dl('luasandbox.' . PHP_SHLIB_SUFFIX); -} -$module = 'luasandbox'; -$functions = get_extension_funcs($module); -echo "Functions available in the test extension:$br\n"; -foreach($functions as $func) { - echo $func."$br\n"; -} -echo "$br\n"; -$function = 'confirm_' . $module . '_compiled'; -if (extension_loaded($module)) { - $str = $function($module); -} else { - $str = "Module $module is not compiled into PHP"; -} -echo "$str\n"; -?> diff -Nru php-luasandbox-3.0.1/luasandbox_types.h php-luasandbox-3.0.3/luasandbox_types.h --- php-luasandbox-3.0.1/luasandbox_types.h 2018-02-28 18:56:42.000000000 +0000 +++ php-luasandbox-3.0.3/luasandbox_types.h 2018-10-11 02:06:41.000000000 +0000 @@ -72,7 +72,9 @@ } php_luasandbox_alloc; struct _php_luasandbox_obj { +#if PHP_VERSION_ID < 70000 zend_object std; +#endif lua_State * state; php_luasandbox_alloc alloc; int in_php; @@ -88,33 +90,58 @@ int function_index; unsigned int random_seed; int allow_pause; +#if PHP_VERSION_ID >= 70000 + zend_object std; +#endif }; typedef struct _php_luasandbox_obj php_luasandbox_obj; struct _php_luasandboxfunction_obj { - zend_object std; #if PHP_VERSION_ID < 70000 + zend_object std; zval * sandbox; + int index; #else zval sandbox; -#endif int index; + zend_object std; +#endif }; typedef struct _php_luasandboxfunction_obj php_luasandboxfunction_obj; // Accessor macros #if PHP_VERSION_ID < 70000 + +static inline php_luasandbox_obj *php_luasandbox_fetch_object(zend_object *obj) { + return (php_luasandbox_obj *)obj; +} + +static inline php_luasandboxfunction_obj *php_luasandboxfunction_fetch_object(zend_object *obj) { + return (php_luasandboxfunction_obj *)obj; +} + #define GET_LUASANDBOX_OBJ(z) (php_luasandbox_obj *)zend_object_store_get_object(z TSRMLS_CC) #define GET_LUASANDBOXFUNCTION_OBJ(z) (php_luasandboxfunction_obj *)zend_object_store_get_object(z TSRMLS_CC) #define LUASANDBOXFUNCTION_SANDBOX_IS_OK(pfunc) (pfunc)->sandbox #define LUASANDBOXFUNCTION_GET_SANDBOX_ZVALPTR(pfunc) (pfunc)->sandbox #define LUASANDBOX_GET_CURRENT_ZVAL_PTR(psandbox) (psandbox)->current_zval + #else -#define GET_LUASANDBOX_OBJ(z) (php_luasandbox_obj *)Z_OBJ_P(z) -#define GET_LUASANDBOXFUNCTION_OBJ(z) (php_luasandboxfunction_obj *)Z_OBJ_P(z) + +static inline php_luasandbox_obj *php_luasandbox_fetch_object(zend_object *obj) { + return (php_luasandbox_obj *)((char*)(obj) - XtOffsetOf(php_luasandbox_obj, std)); +} + +static inline php_luasandboxfunction_obj *php_luasandboxfunction_fetch_object(zend_object *obj) { + return (php_luasandboxfunction_obj *)((char*)(obj) - XtOffsetOf(php_luasandboxfunction_obj, std)); +} + +#define GET_LUASANDBOX_OBJ(z) php_luasandbox_fetch_object(Z_OBJ_P(z)) +#define GET_LUASANDBOXFUNCTION_OBJ(z) php_luasandboxfunction_fetch_object(Z_OBJ_P(z)) #define LUASANDBOXFUNCTION_SANDBOX_IS_OK(pfunc) !Z_ISUNDEF((pfunc)->sandbox) #define LUASANDBOXFUNCTION_GET_SANDBOX_ZVALPTR(pfunc) &((pfunc)->sandbox) #define LUASANDBOX_GET_CURRENT_ZVAL_PTR(psandbox) &((psandbox)->current_zval) + #endif #endif /*LUASANDBOX_TYPES_H*/ diff -Nru php-luasandbox-3.0.1/luasandbox_version.h php-luasandbox-3.0.3/luasandbox_version.h --- php-luasandbox-3.0.1/luasandbox_version.h 2018-02-28 18:56:42.000000000 +0000 +++ php-luasandbox-3.0.3/luasandbox_version.h 2018-10-11 02:06:41.000000000 +0000 @@ -1 +1 @@ -#define LUASANDBOX_VERSION "3.0.1" +#define LUASANDBOX_VERSION "3.0.3" diff -Nru php-luasandbox-3.0.1/package.xml php-luasandbox-3.0.3/package.xml --- php-luasandbox-3.0.1/package.xml 1970-01-01 00:00:00.000000000 +0000 +++ php-luasandbox-3.0.3/package.xml 2018-10-11 02:06:41.000000000 +0000 @@ -0,0 +1,103 @@ + + + LuaSandbox + pecl.php.net + Lua interpreter with limits and safe environment + LuaSandbox is an extension for running untrusted Lua code within a PHP web request. Code is run in a stripped-down, safe environment. Time and memory limits can be set. + + Tim Starling + tstarling + tstarling@wikimedia.org + yes + + 2018-10-11 + + 3.0.3 + 3.0.3 + + + stable + stable + + MIT + + - Fix ZTS build on PHP 7+ (Patch by Remi Collet) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5.2.0 + + + 1.7.0 + + + + luasandbox + + + 2018-10-09 + + 3.0.2 + 3.0.2 + + + - Fix PHP 7 object layout + - Initial PECL release + + + diff -Nru php-luasandbox-3.0.1/tests/bug57292.phpt php-luasandbox-3.0.3/tests/bug57292.phpt --- php-luasandbox-3.0.1/tests/bug57292.phpt 2018-02-28 18:56:42.000000000 +0000 +++ php-luasandbox-3.0.3/tests/bug57292.phpt 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ ---TEST-- -Extending LuaSandbox (bug 57292) ---FILE-- -var2 = 42; -echo "ok\n"; - -// HHVM leaks it otherwise, and the warning makes the test fail -unset( $sandbox ); - ---EXPECT-- -ok diff -Nru php-luasandbox-3.0.1/tests/extending-LuaSandbox.phpt php-luasandbox-3.0.3/tests/extending-LuaSandbox.phpt --- php-luasandbox-3.0.1/tests/extending-LuaSandbox.phpt 1970-01-01 00:00:00.000000000 +0000 +++ php-luasandbox-3.0.3/tests/extending-LuaSandbox.phpt 2018-10-11 02:06:41.000000000 +0000 @@ -0,0 +1,65 @@ +--TEST-- +Extending LuaSandbox +--FILE-- +{"var$i"} = $i; +} +var_dump( $sandbox ); + +for($i=6; $i<=10; $i++){ + $sandbox->{"var$i"} = $i; +} +var_dump( $sandbox ); + +echo "ok\n"; + +// HHVM leaks it otherwise, and the warning makes the test fail +unset( $sandbox ); + +--EXPECT-- +object(ExtendedLuaSandbox)#1 (5) { + ["var1"]=> + int(1) + ["var2"]=> + int(2) + ["var3"]=> + int(3) + ["var4"]=> + int(4) + ["var5"]=> + int(5) +} +object(ExtendedLuaSandbox)#1 (10) { + ["var1"]=> + int(1) + ["var2"]=> + int(2) + ["var3"]=> + int(3) + ["var4"]=> + int(4) + ["var5"]=> + int(5) + ["var6"]=> + int(6) + ["var7"]=> + int(7) + ["var8"]=> + int(8) + ["var9"]=> + int(9) + ["var10"]=> + int(10) +} +ok