Skip to content

Commit 8bfc037

Browse files
committed
Fixed invaid write/read
1 parent 541842d commit 8bfc037

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

ext/simplexml/simplexml.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
457457
int new_value = 0;
458458
long cnt = 0;
459459
int retval = SUCCESS;
460-
zval tmp_zv, trim_zv, value_copy;
460+
zval tmp_zv, trim_zv, zval_copy;
461461

462462
sxe = Z_SXEOBJ_P(object);
463463

@@ -535,7 +535,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
535535
case IS_OBJECT:
536536
if (Z_OBJCE_P(value) == sxe_class_entry) {
537537
//???
538-
value = sxe_get_value(value, value TSRMLS_CC);
538+
value = sxe_get_value(value, &zval_copy TSRMLS_CC);
539539
//INIT_PZVAL(value);
540540
new_value = 1;
541541
break;
@@ -657,9 +657,6 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
657657
if (pnewnode) {
658658
*pnewnode = newnode;
659659
}
660-
if (value && value == &value_copy) {
661-
zval_ptr_dtor(value);
662-
}
663660
if (new_value) {
664661
zval_ptr_dtor(value);
665662
}
@@ -816,9 +813,9 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend
816813
}
817814
if (node) {
818815
exists = 1;
819-
if (check_empty == 1 &&
816+
if (check_empty == 1 &&
820817
(!node->children || (node->children->type == XML_TEXT_NODE && !node->children->next &&
821-
(!node->children->content || !node->children->content[0] || !xmlStrcmp(node->children->content, "0")))) ) {
818+
(!node->children->content || !node->children->content[0] || !xmlStrcmp(node->children->content, "0")))) ) {
822819
exists = 0;
823820
}
824821
}

0 commit comments

Comments
 (0)