cvs: php4 /ext/standard basic_functions.c exec.c var.c /ext/wddx wddx.c /ext/xml xml.c
| From: | Zeev Suraski | Date: | Wed, 13 Dec 2000 22:50:11 +0000 |
| Subject: | cvs: php4 /ext/standard basic_functions.c exec.c var.c /ext/wddx wddx.c /ext/xml xml.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-3132@lists.php.net to get a copy of this message | ||
zeev Wed Dec 13 14:50:11 2000 EDT
Modified files:
/php4/ext/standard basic_functions.c exec.c var.c
/php4/ext/wddx wddx.c
/php4/ext/xml xml.c
Log:
Fix call_user_function() with objects - it could leak under certain circumstances
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.285 php4/ext/standard/basic_functions.c:1.286
--- php4/ext/standard/basic_functions.c:1.285 Fri Dec 8 06:37:49 2000
+++ php4/ext/standard/basic_functions.c Wed Dec 13 14:50:10 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.285 2000/12/08 14:37:49 sterling Exp $ */
+/* $Id: basic_functions.c,v 1.286 2000/12/13 22:50:10 zeev Exp $ */
#include "php.h"
#include "php_main.h"
@@ -1618,7 +1618,7 @@
SEPARATE_ZVAL(params[0]);
SEPARATE_ZVAL(params[1]);
convert_to_string(*params[0]);
- if (call_user_function_ex(CG(function_table), *params[1], *params[0], &retval_ptr,
arg_count-2, params+2, 1, NULL)==SUCCESS
+ if (call_user_function_ex(CG(function_table), *params[1], params[0], &retval_ptr, arg_count-2,
params+2, 1, NULL)==SUCCESS
&& retval_ptr) {
COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
} else {
@@ -1659,7 +1659,7 @@
zend_hash_move_forward(params_ar))
element++;
- if (call_user_function_ex(CG(function_table), *obj, *method_name, &retval_ptr, num_elems,
method_args, 1, NULL) == SUCCESS
+ if (call_user_function_ex(CG(function_table), obj, *method_name, &retval_ptr, num_elems,
method_args, 1, NULL) == SUCCESS
&& retval_ptr) {
COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
} else {
Index: php4/ext/standard/exec.c
diff -u php4/ext/standard/exec.c:1.41 php4/ext/standard/exec.c:1.42
--- php4/ext/standard/exec.c:1.41 Mon Nov 27 05:31:21 2000
+++ php4/ext/standard/exec.c Wed Dec 13 14:50:10 2000
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf |
+----------------------------------------------------------------------+
*/
-/* $Id: exec.c,v 1.41 2000/11/27 13:31:21 sas Exp $ */
+/* $Id: exec.c,v 1.42 2000/12/13 22:50:10 zeev Exp $ */
#include <stdio.h>
#include "php.h"
@@ -421,7 +421,8 @@
allocated_space = EXEC_INPUT_BUF;
ret = (char *) emalloc(allocated_space);
while (1) {
- readbytes = fread(ret+total_readbytes,1,EXEC_INPUT_BUF,in);
+// readbytes = fread(ret+total_readbytes,1,EXEC_INPUT_BUF,in);
+ readbytes = fread(ret+total_readbytes,1,5,in);
if (readbytes<=0) {
break;
}
Index: php4/ext/standard/var.c
diff -u php4/ext/standard/var.c:1.82 php4/ext/standard/var.c:1.83
--- php4/ext/standard/var.c:1.82 Mon Dec 11 06:29:25 2000
+++ php4/ext/standard/var.c Wed Dec 13 14:50:10 2000
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var.c,v 1.82 2000/12/11 14:29:25 stas Exp $ */
+/* $Id: var.c,v 1.83 2000/12/13 22:50:10 zeev Exp $ */
/* {{{ includes
@@ -240,7 +240,7 @@
MAKE_STD_ZVAL(fname);
ZVAL_STRING(fname,"__sleep",1);
- res = call_user_function_ex(CG(function_table), *struc, fname, &retval_ptr, 0, 0, 1,
NULL);
+ res = call_user_function_ex(CG(function_table), struc, fname, &retval_ptr, 0, 0, 1, NULL);
if (res == SUCCESS) {
if (retval_ptr && HASH_OF(retval_ptr)) {
@@ -597,7 +597,7 @@
MAKE_STD_ZVAL(fname);
ZVAL_STRING(fname,"__wakeup",1);
- call_user_function_ex(CG(function_table), *rval, fname, &retval_ptr, 0, 0, 1, NULL);
+ call_user_function_ex(CG(function_table), rval, fname, &retval_ptr, 0, 0, 1, NULL);
zval_dtor(fname);
FREE_ZVAL(fname);
Index: php4/ext/wddx/wddx.c
diff -u php4/ext/wddx/wddx.c:1.58 php4/ext/wddx/wddx.c:1.59
--- php4/ext/wddx/wddx.c:1.58 Wed Oct 25 10:44:02 2000
+++ php4/ext/wddx/wddx.c Wed Dec 13 14:50:10 2000
@@ -27,7 +27,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: wddx.c,v 1.58 2000/10/25 17:44:02 andrei Exp $ */
+/* $Id: wddx.c,v 1.59 2000/12/13 22:50:10 zeev Exp $ */
#include "php.h"
#include "php_wddx.h"
@@ -424,7 +424,7 @@
* We try to call __sleep() method on object. It's supposed to return an
* array of property names to be serialized.
*/
- if (call_user_function_ex(CG(function_table), obj, fname, &retval, 0, 0, 1, NULL) == SUCCESS)
{
+ if (call_user_function_ex(CG(function_table), &obj, fname, &retval, 0, 0, 1, NULL) ==
SUCCESS) {
if (retval && HASH_OF(retval)) {
PHP_CLASS_ATTRIBUTES;
@@ -781,7 +781,7 @@
MAKE_STD_ZVAL(fname);
ZVAL_STRING(fname, "__wakeup", 1);
- call_user_function_ex(NULL, ent1->data, fname, &retval, 0, 0, 0, NULL);
+ call_user_function_ex(NULL, &ent1->data, fname, &retval, 0, 0, 0, NULL);
zval_dtor(fname);
FREE_ZVAL(fname);
Index: php4/ext/xml/xml.c
diff -u php4/ext/xml/xml.c:1.65 php4/ext/xml/xml.c:1.66
--- php4/ext/xml/xml.c:1.65 Sun Oct 29 01:14:54 2000
+++ php4/ext/xml/xml.c Wed Dec 13 14:50:10 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xml.c,v 1.65 2000/10/29 09:14:54 thies Exp $ */
+/* $Id: xml.c,v 1.66 2000/12/13 22:50:10 zeev Exp $ */
#define IS_EXT_MODULE
#include "php.h"
@@ -358,7 +358,7 @@
retval->type = IS_BOOL;
retval->value.lval = 0;
- result = call_user_function(EG(function_table), parser->object, handler, retval, argc, argv);
+ result = call_user_function(EG(function_table), &parser->object, handler, retval, argc,
argv);
if (result == FAILURE) {
zval **method;