]> granicus.if.org Git - php/commitdiff
Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()).
authorXinchen Hui <laruence@gmail.com>
Sun, 24 Sep 2017 09:24:11 +0000 (17:24 +0800)
committerXinchen Hui <laruence@gmail.com>
Sun, 24 Sep 2017 09:24:11 +0000 (17:24 +0800)
NEWS
Zend/tests/bug75241.phpt [new file with mode: 0644]
Zend/zend_operators.c

diff --git a/NEWS b/NEWS
index f1cc520650ba2940ae55f27a40593f079740a0af..37520dc7d30e759fe829767ca8662c8f88b149db 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP                                                                        NEWS
 ?? ??? 2017 PHP 7.0.25
 
 - Core:
+  . Fixed bug #75241 (Null pointer dereference in zend_mm_alloc_small()).
+    (Laruence)
   . Fixed bug #75236 (infinite loop when printing an error-message). (Andrea)
   . Fixed bug #75252 (Incorrect token formatting on two parse errors in one
     request). (Nikita)
diff --git a/Zend/tests/bug75241.phpt b/Zend/tests/bug75241.phpt
new file mode 100644 (file)
index 0000000..1751bbe
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+Bug #75241 (Null pointer dereference in zend_mm_alloc_small())
+--FILE--
+<?php
+function eh(){}
+
+set_error_handler('eh');
+
+$d->d = &$d + $d->d/=0;
+var_dump($d);
+?>
+--EXPECT--
+float(INF)
index 3a8929b83f9ffef543890ffc426f903acbf2740b..d87dba919b73b7ae3ef3023543f97b157e3a2fd3 100644 (file)
@@ -221,8 +221,10 @@ try_again:
                                        if (Z_TYPE(holder) == IS_LONG) {                                \
                                                if (op == result) {                                                     \
                                                        zval_ptr_dtor(op);                                              \
+                                                       ZVAL_LONG(op, Z_LVAL(holder));                  \
+                                               } else {                                                                        \
+                                                       (op) = &(holder);                                               \
                                                }                                                                                       \
-                                               (op) = &(holder);                                                       \
                                        }                                                                                               \
                                        break;                                                                                  \
                        }                                                                                                               \