dmitry Mon Apr 11 07:58:21 2005 EDT
Modified files:
/php-src/ext/wddx wddx.c
Log:
Fixed SIGSEGV on serializing data with circular references
http://cvs.php.net/diff.php/php-src/ext/wddx/wddx.c?r1=1.115&r2=1.116&ty=u
Index: php-src/ext/wddx/wddx.c
diff -u php-src/ext/wddx/wddx.c:1.115 php-src/ext/wddx/wddx.c:1.116
--- php-src/ext/wddx/wddx.c:1.115 Mon Apr 11 05:27:47 2005
+++ php-src/ext/wddx/wddx.c Mon Apr 11 07:58:19 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: wddx.c,v 1.115 2005/04/11 09:27:47 dmitry Exp $ */
+/* $Id: wddx.c,v 1.116 2005/04/11 11:58:19 dmitry Exp $ */
#include "php.h"
@@ -620,6 +620,7 @@
char tmp_buf[WDDX_BUF_LEN];
char *name_esc;
int name_esc_len;
+ HashTable *ht;
if (name) {
name_esc = php_escape_html_entities(name, name_len,
&name_esc_len, 0, ENT_QUOTES, NULL TSRMLS_CC);
@@ -647,11 +648,25 @@
break;
case IS_ARRAY:
+ ht = Z_ARRVAL_P(var);
+ if (ht->nApplyCount > 1) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "WDDX
doesn't support circular references");
+ return;
+ }
+ ht->nApplyCount++;
php_wddx_serialize_array(packet, var);
+ ht->nApplyCount--;
break;
case IS_OBJECT:
- php_wddx_serialize_object(packet, var);
+ ht = Z_OBJPROP_P(var);
+ if (ht->nApplyCount > 1) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "WDDX
doesn't support circular references");
+ return;
+ }
+ ht->nApplyCount++;
+ php_wddx_serialize_object(packet, var);
+ ht->nApplyCount--;
break;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php