Skip to content

Commit

Permalink
Fixed bug #76796
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Sep 7, 2018
1 parent b323e1e commit cfdd828
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion ext/opcache/Optimizer/sccp.c
Expand Up @@ -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;
}

Expand Down
16 changes: 16 additions & 0 deletions 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

0 comments on commit cfdd828

Please sign in to comment.