Skip to content

Commit b05ff14

Browse files
committed
Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()).
1 parent db63367 commit b05ff14

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ PHP NEWS
33
?? ??? 2017 PHP 7.0.25
44

55
- Core:
6+
. Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()).
7+
(Laruence)
68
. Fixed bug #75236 (infinite loop when printing an error-message). (Andrea)
79
. Fixed bug #75252 (Incorrect token formatting on two parse errors in one
810
request). (Nikita)

Zend/tests/bug75241.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Bug #75241 (Null pointer dereference in zend_mm_alloc_small())
3+
--FILE--
4+
<?php
5+
function eh(){}
6+
7+
set_error_handler('eh');
8+
9+
$d->d = &$d + $d->d/=0;
10+
var_dump($d);
11+
?>
12+
--EXPECT--
13+
float(INF)

Zend/zend_operators.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,10 @@ ZEND_API void ZEND_FASTCALL convert_scalar_to_number(zval *op) /* {{{ */
221221
if (Z_TYPE(holder) == IS_LONG) { \
222222
if (op == result) { \
223223
zval_ptr_dtor(op); \
224+
ZVAL_LONG(op, Z_LVAL(holder)); \
225+
} else { \
226+
(op) = &(holder); \
224227
} \
225-
(op) = &(holder); \
226228
} \
227229
break; \
228230
} \

0 commit comments

Comments
 (0)