summaryrefslogtreecommitdiff
path: root/src/sp_disabled_functions.c
diff options
context:
space:
mode:
authorjvoisin2017-10-10 14:47:56 +0200
committerjvoisin2017-10-10 14:47:56 +0200
commitef1cb7661ed577039c7fa6caea7490330237f091 (patch)
tree4ac7652b259a99cec284bc8929f2b75fde4112b8 /src/sp_disabled_functions.c
parent6c458dcf33ae2b1fb17bf9104ab0bb4fa6f23910 (diff)
Bump coverage, and fix a segfault on trace matching
Diffstat (limited to 'src/sp_disabled_functions.c')
-rw-r--r--src/sp_disabled_functions.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c
index b465a30..e4ba19a 100644
--- a/src/sp_disabled_functions.c
+++ b/src/sp_disabled_functions.c
@@ -15,6 +15,11 @@ ZEND_COLD static zend_always_inline bool is_hash_matching(
15 15
16static zend_always_inline char* get_complete_function_path( 16static zend_always_inline char* get_complete_function_path(
17 zend_execute_data const* const execute_data) { 17 zend_execute_data const* const execute_data) {
18
19 if (!(execute_data->func->common.function_name)) {
20 return NULL;
21 }
22
18 char const* class_name; 23 char const* class_name;
19 char const* const function_name = 24 char const* const function_name =
20 ZSTR_VAL(execute_data->func->common.function_name); 25 ZSTR_VAL(execute_data->func->common.function_name);
@@ -38,12 +43,16 @@ static bool is_functions_list_matching(zend_execute_data *execute_data, sp_node_
38 43
39 while (current) { 44 while (current) {
40 if (it == NULL) { // every function in the list matched, we've got a match! 45 if (it == NULL) { // every function in the list matched, we've got a match!
46 EG(current_execute_data) = orig_execute_data;
41 return true; 47 return true;
42 } 48 }
43 49
44 EG(current_execute_data) = current; 50 EG(current_execute_data) = current;
45 51
46 char *complete_path_function = get_complete_function_path(current); 52 char *complete_path_function = get_complete_function_path(current);
53 if (!complete_path_function) {
54 goto end;
55 }
47 int match = strcmp(((char*)it->data), complete_path_function); 56 int match = strcmp(((char*)it->data), complete_path_function);
48 efree(complete_path_function); 57 efree(complete_path_function);
49 58
@@ -51,11 +60,11 @@ static bool is_functions_list_matching(zend_execute_data *execute_data, sp_node_
51 it = it->next; 60 it = it->next;
52 current = current->prev_execute_data; 61 current = current->prev_execute_data;
53 } else { 62 } else {
54 EG(current_execute_data) = orig_execute_data; 63 goto end;
55 return false;
56 } 64 }
57 } 65 }
58 66
67end:
59 EG(current_execute_data) = orig_execute_data; 68 EG(current_execute_data) = orig_execute_data;
60 return false; 69 return false;
61} 70}