Skip to content

Commit b52fa58

Browse files
committed
fix invalid read, follow up on 97b65cc
1 parent d30b73a commit b52fa58

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Zend/zend_ini_parser.y

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,16 @@ static void zend_ini_init_string(zval *result)
109109
static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
110110
{
111111
int length, op1_len;
112+
zend_string *str = NULL;
112113

113114
if (Z_TYPE_P(op1) != IS_STRING) {
114-
zend_string *str = zval_get_string(op1);
115+
str = zval_get_string(op1);
115116
/* ZEND_ASSERT(!Z_REFCOUNTED_P(op1)); */
116117
if (ZEND_SYSTEM_INI) {
117118
ZVAL_PSTRINGL(op1, ZSTR_VAL(str), ZSTR_LEN(str));
118119
} else {
119120
ZVAL_STR(op1, str);
120121
}
121-
zend_string_release(str);
122122
}
123123
op1_len = (int)Z_STRLEN_P(op1);
124124

@@ -129,6 +129,10 @@ static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
129129

130130
ZVAL_NEW_STR(result, zend_string_extend(Z_STR_P(op1), length, ZEND_SYSTEM_INI));
131131
memcpy(Z_STRVAL_P(result) + op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2) + 1);
132+
133+
if (str) {
134+
zend_string_release(str);
135+
}
132136
}
133137
/* }}} */
134138

0 commit comments

Comments
 (0)