com php-src: Fixed bug #76796: NEWS ext/opcache/Optimizer/sccp.c ext/opcache/tests/bug76796.phpt
| From: | Nikita Popov | Date: | Fri, 07 Sep 2018 12:02:03 +0000 |
| Subject: | com php-src: Fixed bug #76796: NEWS ext/opcache/Optimizer/sccp.c ext/opcache/tests/bug76796.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-103018@lists.php.net to get a copy of this message | ||
Commit: cfdd828163bc03b63e41d92adc5b127f567e4c46
Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 7 Sep 2018 14:02:03 +0200
Parents: b323e1e8d07f655756b4ecb23e45cc424c0a9937
Branches: PHP-7.2 PHP-7.3 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cfdd828163bc03b63e41d92adc5b127f567e4c46
Log:
Fixed bug #76796
Bugs:
https://bugs.php.net/76796
Changed paths:
M NEWS
M ext/opcache/Optimizer/sccp.c
A ext/opcache/tests/bug76796.phpt
Diff:
diff --git a/NEWS b/NEWS
index 5186e6b..932a36a 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP NEWS
- Opcache:
. Fixed bug #76832 (ZendOPcache.MemoryBase periodically deleted by the OS).
(Anatol)
+ . Fixed bug #76796 (Compile-time evaluation of disabled function in opcache
+ causes segfault). (Nikita)
- POSIX:
. Fixed bug #75696 (posix_getgrnam fails to print details of group). (cmb)
diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c
index e6d40d8..6a7765a 100644
--- a/ext/opcache/Optimizer/sccp.c
+++ b/ext/opcache/Optimizer/sccp.c
@@ -833,7 +833,8 @@ static inline int ct_eval_func_call(
}
func = zend_hash_find_ptr(CG(function_table), name);
- if (!func || func->type != ZEND_INTERNAL_FUNCTION) {
+ if (!func || func->type != ZEND_INTERNAL_FUNCTION
+ || func->internal_function.handler == ZEND_FN(display_disabled_function)) {
return FAILURE;
}
diff --git a/ext/opcache/tests/bug76796.phpt b/ext/opcache/tests/bug76796.phpt
new file mode 100644
index 0000000..8388484
--- /dev/null
+++ b/ext/opcache/tests/bug76796.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #76796: Compile-time evaluation of disabled function in opcache (SCCP) causes segfault
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+disable_functions=strpos
+--FILE--
+<?php
+
+var_dump(strpos('foo', 'bar'));
+
+?>
+--EXPECTF--
+Warning: strpos() has been disabled for security reasons in %s on line %d
+NULL