From 28c5d156fe21dd9e3ddcd318b0bf7dd3b387a28a Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Sat, 8 Mar 2014 20:43:18 +0000 Subject: [PATCH] Adding missing PHP 5.6 opcodes. --- srm_oparray.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/srm_oparray.c b/srm_oparray.c index 81a872c..28b868b 100644 --- a/srm_oparray.c +++ b/srm_oparray.c @@ -232,6 +232,9 @@ /* 161 */ { "GENERATOR_RETURN", NONE_USED }, /* 162 */ { "FAST_CALL", OP1_USED }, /* 163 */ { "FAST_RET", NONE_USED }, + /* 164 */ { "ZEND_RECV_VARIADIC", ALL_USED }, + /* 165 */ { "POW", ALL_USED }, + /* 166 */ { "POW_ASSIGN", ALL_USED | EXT_VAL }, #endif }; -- 1.8.5.5 From b116904efc9399a1fcf3933efeba12b556dde593 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Tue, 22 Oct 2013 09:58:31 +0100 Subject: [PATCH] Fixed license headers in files. --- CREDITS | 4 ++-- LICENSE | 23 +++++++++++++++++++++++ branchinfo.c | 14 ++++---------- branchinfo.h | 14 ++++---------- php_vld.h | 14 ++++---------- set.c | 14 ++++---------- set.h | 14 ++++---------- srm_oparray.c | 14 ++++---------- srm_oparray.h | 14 ++++---------- vld.c | 14 ++++---------- 10 files changed, 57 insertions(+), 82 deletions(-) create mode 100644 LICENSE diff --git a/CREDITS b/CREDITS index 86e26f2..70c997b 100644 --- a/CREDITS +++ b/CREDITS @@ -1,2 +1,2 @@ -vle -Marcus Börger, Derick Rethans, Andrei Zmievski +vld +Marcus Börger, Derick Rethans, Andrei Zmievski and others diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..14dbb68 --- /dev/null +++ b/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2002-2013, Derick Rethans + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/branchinfo.c b/branchinfo.c index d8379af..1702899 100644 --- a/branchinfo.c +++ b/branchinfo.c @@ -1,16 +1,10 @@ /* +----------------------------------------------------------------------+ - | PHP Version 4 | + | Copyright (c) 1997-2013 Derick Rethans | +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | + | This source file is subject to the 2-Clause BSD license which is | + | available through the LICENSE file, or online at | + | http://opensource.org/licenses/bsd-license.php | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ diff --git a/branchinfo.h b/branchinfo.h index 0d1e020..27b4f42 100644 --- a/branchinfo.h +++ b/branchinfo.h @@ -1,16 +1,10 @@ /* +----------------------------------------------------------------------+ - | PHP Version 4 | + | Copyright (c) 1997-2013 Derick Rethans | +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | + | This source file is subject to the 2-Clause BSD license which is | + | available through the LICENSE file, or online at | + | http://opensource.org/licenses/bsd-license.php | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ diff --git a/php_vld.h b/php_vld.h index b9d4a34..85ae8f1 100644 --- a/php_vld.h +++ b/php_vld.h @@ -1,16 +1,10 @@ /* +----------------------------------------------------------------------+ - | PHP Version 4 | + | Copyright (c) 1997-2013 Derick Rethans | +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | + | This source file is subject to the 2-Clause BSD license which is | + | available through the LICENSE file, or online at | + | http://opensource.org/licenses/bsd-license.php | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ diff --git a/set.c b/set.c index 595900b..80917ce 100644 --- a/set.c +++ b/set.c @@ -1,16 +1,10 @@ /* +----------------------------------------------------------------------+ - | PHP Version 4 | + | Copyright (c) 1997-2013 Derick Rethans | +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | + | This source file is subject to the 2-Clause BSD license which is | + | available through the LICENSE file, or online at | + | http://opensource.org/licenses/bsd-license.php | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ diff --git a/set.h b/set.h index 01c94c4..6bfaf7c 100644 --- a/set.h +++ b/set.h @@ -1,16 +1,10 @@ /* +----------------------------------------------------------------------+ - | PHP Version 4 | + | Copyright (c) 1997-2013 Derick Rethans | +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | + | This source file is subject to the 2-Clause BSD license which is | + | available through the LICENSE file, or online at | + | http://opensource.org/licenses/bsd-license.php | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ diff --git a/srm_oparray.c b/srm_oparray.c index c1f2ee2..bce534b 100644 --- a/srm_oparray.c +++ b/srm_oparray.c @@ -1,16 +1,10 @@ /* +----------------------------------------------------------------------+ - | PHP Version 4 | + | Copyright (c) 1997-2013 Derick Rethans | +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | + | This source file is subject to the 2-Clause BSD license which is | + | available through the LICENSE file, or online at | + | http://opensource.org/licenses/bsd-license.php | +----------------------------------------------------------------------+ | Authors: Derick Rethans | | Andrei Zmievski | diff --git a/srm_oparray.h b/srm_oparray.h index 9656c2f..355a1ad 100644 --- a/srm_oparray.h +++ b/srm_oparray.h @@ -1,16 +1,10 @@ /* +----------------------------------------------------------------------+ - | PHP Version 4 | + | Copyright (c) 1997-2013 Derick Rethans | +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | + | This source file is subject to the 2-Clause BSD license which is | + | available through the LICENSE file, or online at | + | http://opensource.org/licenses/bsd-license.php | +----------------------------------------------------------------------+ | Authors: Derick Rethans | | Andrei Zmievski | diff --git a/vld.c b/vld.c index e7eae4f..831959a 100644 --- a/vld.c +++ b/vld.c @@ -1,16 +1,10 @@ /* +----------------------------------------------------------------------+ - | PHP Version 4 | + | Copyright (c) 1997-2013 Derick Rethans | +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | + | This source file is subject to the 2-Clause BSD license which is | + | available through the LICENSE file, or online at | + | http://opensource.org/licenses/bsd-license.php | +----------------------------------------------------------------------+ | Authors: Derick Rethans | +----------------------------------------------------------------------+ -- 1.9.3 From 6c3b76529e29d986a82735c12763b8bf839ff5bc Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Thu, 13 Mar 2014 13:58:10 -0500 Subject: [PATCH] Fixed memory leaks and wrongly typed ints. --- branchinfo.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/branchinfo.c b/branchinfo.c index cf2545b..8c223c8 100644 --- a/branchinfo.c +++ b/branchinfo.c @@ -36,9 +36,16 @@ vld_branch_info *vld_branch_info_create(unsigned int size) void vld_branch_info_free(vld_branch_info *branch_info) { + unsigned int i; + + for (i = 0; i < branch_info->paths_count; i++) { + free(branch_info->paths[i]->elements); + free(branch_info->paths[i]); + } + free(branch_info->paths); free(branch_info->branches); - free(branch_info->starts); - free(branch_info->ends); + vld_set_free(branch_info->starts); + vld_set_free(branch_info->ends); free(branch_info); } @@ -51,7 +58,8 @@ void vld_branch_info_update(vld_branch_info *branch_info, unsigned int pos, unsi void vld_branch_post_process(vld_branch_info *branch_info) { - int i, in_branch = 0, last_start = -1; + unsigned int i; + int in_branch = 0, last_start = -1; for (i = 0; i < branch_info->starts->size; i++) { if (vld_set_in(branch_info->starts, i)) { @@ -123,7 +131,7 @@ static unsigned int vld_branch_find_last_element(vld_path *path) static int vld_path_exists(vld_path *path, unsigned int elem1, unsigned int elem2) { - int i; + unsigned int i; for (i = 0; i < path->elements_count - 1; i++) { if (path->elements[i] == elem1 && path->elements[i + 1] == elem2) { @@ -172,7 +180,7 @@ void vld_branch_find_paths(vld_branch_info *branch_info) void vld_branch_info_dump(zend_op_array *opa, vld_branch_info *branch_info TSRMLS_DC) { - int i, j; + unsigned int i, j; char *fname = opa->function_name ? opa->function_name : "__main"; if (VLD_G(path_dump_file)) { -- 1.9.3 From efbcfa7f34b397e58a43a0b5d34cf0bf95472907 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Sun, 16 Mar 2014 10:15:04 -0500 Subject: [PATCH] Fixed cont/brk jump point analysis. This could never ever have worked before. --- srm_oparray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srm_oparray.c b/srm_oparray.c index 503fcb0..b023cae 100644 --- a/srm_oparray.c +++ b/srm_oparray.c @@ -782,7 +782,7 @@ int vld_find_jump(zend_op_array *opa, unsigned int position, long *jmp1, long *j #endif ) { #if PHP_VERSION_ID >= 50399 - el = vld_find_brk_cont(opcode.op2.constant, VLD_ZNODE_ELEM(opcode.op1, opline_num), opa); + el = vld_find_brk_cont(Z_LVAL_P(opcode.op2.zv), VLD_ZNODE_ELEM(opcode.op1, opline_num), opa); #else el = vld_find_brk_cont(opcode.op2.u.constant.value.lval, VLD_ZNODE_ELEM(opcode.op1, opline_num), opa); #endif -- 1.9.3 From ab0a701555da63da026bc27450d42c748b6ec170 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 2 May 2014 12:02:24 +0100 Subject: [PATCH] Rename to use the same order as the other ASSIGN opcodes. --- srm_oparray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srm_oparray.c b/srm_oparray.c index b023cae..0e1a6fb 100644 --- a/srm_oparray.c +++ b/srm_oparray.c @@ -234,7 +234,7 @@ static const op_usage opcodes[] = { /* 163 */ { "FAST_RET", NONE_USED }, /* 164 */ { "ZEND_RECV_VARIADIC", ALL_USED }, /* 165 */ { "POW", ALL_USED }, - /* 166 */ { "POW_ASSIGN", ALL_USED | EXT_VAL }, + /* 166 */ { "ASSIGN_POW", ALL_USED | EXT_VAL }, #endif }; -- 1.9.3 From d5880af0a6a1532857933d920774de4b1715ea8a Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Fri, 2 May 2014 12:02:42 +0100 Subject: [PATCH] Replace IS_CONSTANT_ARRAY with IS_CONSTANT_AST for PHP 5.6 and later. --- srm_oparray.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/srm_oparray.c b/srm_oparray.c index 0e1a6fb..553d8bd 100644 --- a/srm_oparray.c +++ b/srm_oparray.c @@ -319,10 +319,17 @@ static inline int vld_dump_zval_constant(zvalue_value value) return vld_printf (stderr, "", value.str.val); } +#if PHP_VERSION_ID >= 50600 +static inline int vld_dump_zval_constant_ast(zvalue_value value) +{ + return vld_printf (stderr, ""); +} +#else static inline int vld_dump_zval_constant_array(zvalue_value value) { return vld_printf (stderr, ""); } +#endif int vld_dump_zval (zval val) @@ -337,7 +344,11 @@ int vld_dump_zval (zval val) case IS_BOOL: return vld_dump_zval_bool (val.value); case IS_RESOURCE: return vld_dump_zval_resource (val.value); case IS_CONSTANT: return vld_dump_zval_constant (val.value); +#if PHP_VERSION_ID >= 50600 + case IS_CONSTANT_AST: return vld_dump_zval_constant_ast (val.value); +#else case IS_CONSTANT_ARRAY: return vld_dump_zval_constant_array (val.value); +#endif #if PHP_VERSION_ID >= 60000 case IS_UNICODE: return vld_dump_zval_unicode (val.value); #endif -- 1.9.3