]> granicus.if.org Git - php/commitdiff
use zend_ascii_hash_find() and check its return value to prevent crash when function...
authorAntony Dovgal <tony2001@php.net>
Wed, 2 Jul 2008 10:46:52 +0000 (10:46 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 2 Jul 2008 10:46:52 +0000 (10:46 +0000)
ext/spl/spl_directory.c

index 74a34695614464a155ed26ca623462c8b474d3cf..b55e3d88b60c348cf89f0f34bbfcb1f2505174ae 100755 (executable)
@@ -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); \
 } /* }}} */