diff options
| author | Thibault "bui" Koechlin | 2018-01-26 18:35:40 +0100 |
|---|---|---|
| committer | jvoisin | 2018-01-26 18:35:40 +0100 |
| commit | c853c3fcc7ba2efbf78ef80b46dddda57d132510 (patch) | |
| tree | 918e818e8b3d5337999fdd4ba44a57c140bf7b67 /src/sp_var_value.c | |
| parent | a5b0956aa6bf91912dd8127b9b5e9f76f7f4730e (diff) | |
Fix a segfault in `get_local_var` (#138)
This commit fixes a segfault where 'get_local_var' would fail if no functions where called yet (`symtable` will be NULL)
Diffstat (limited to 'src/sp_var_value.c')
| -rw-r--r-- | src/sp_var_value.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sp_var_value.c b/src/sp_var_value.c index a3eed3e..05598bf 100644 --- a/src/sp_var_value.c +++ b/src/sp_var_value.c | |||
| @@ -27,6 +27,11 @@ static zval *get_local_var(zend_execute_data *ed, const char *var_name) { | |||
| 27 | EG(current_execute_data) = current; | 27 | EG(current_execute_data) = current; |
| 28 | zend_array *symtable = zend_rebuild_symbol_table(); | 28 | zend_array *symtable = zend_rebuild_symbol_table(); |
| 29 | 29 | ||
| 30 | if (UNEXPECTED(symtable == NULL)) { | ||
| 31 | EG(current_execute_data) = orig_execute_data; | ||
| 32 | return NULL; | ||
| 33 | } | ||
| 34 | |||
| 30 | ZEND_HASH_FOREACH_STR_KEY_VAL(symtable, key, value) { | 35 | ZEND_HASH_FOREACH_STR_KEY_VAL(symtable, key, value) { |
| 31 | if (0 == strcmp(var_name, key->val)) { | 36 | if (0 == strcmp(var_name, key->val)) { |
| 32 | if (Z_TYPE_P(value) == IS_INDIRECT) { | 37 | if (Z_TYPE_P(value) == IS_INDIRECT) { |
