From: Antony Dovgal Date: Wed, 2 Jul 2008 10:46:52 +0000 (+0000) Subject: use zend_ascii_hash_find() and check its return value to prevent crash when function... X-Git-Tag: BEFORE_HEAD_NS_CHANGE~1417 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=15e70c34e247cc332df552c31d9c0899abf4d871;p=php use zend_ascii_hash_find() and check its return value to prevent crash when function not found --- diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 74a3469561..b55e3d88b6 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -1870,7 +1870,12 @@ static int spl_filesystem_file_call(spl_filesystem_object *intern, zend_function #define FileFunctionCall(func_name, pass_num_args, arg2) /* {{{ */\ { \ zend_function *func_ptr; \ - zend_hash_find(EG(function_table), #func_name, sizeof(#func_name), (void **) &func_ptr); \ + int ret; \ + ret = zend_ascii_hash_find(EG(function_table), #func_name, sizeof(#func_name), (void **) &func_ptr); \ + if (ret != SUCCESS) { \ + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Internal error, function '%s' not found. Please report", #func_name); \ + return; \ + } \ spl_filesystem_file_call(intern, func_ptr, pass_num_args, return_value, arg2 TSRMLS_CC); \ } /* }}} */