From deebb3f0ddbcf0720c0698987b54523101f5ef0a Mon Sep 17 00:00:00 2001 From: jpeeler Date: Fri, 18 Jun 2010 21:32:09 +0000 Subject: Merged revisions 271399 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r271399 | jpeeler | 2010-06-18 14:28:24 -0500 (Fri, 18 Jun 2010) | 11 lines Fix crash when parsing some heavily nested statements in AEL on reload. Due to the recursion used when compiling AEL in gen_prios, all the stack space was being consumed when parsing some AEL that contained nesting 13 levels deep. Changing a few large buffers to be heap allocated fixed the crash, although I did not test how many more levels can now be safely used. (closes issue #16053) Reported by: diLLec Tested by: jpeeler ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@271483 f38db490-d61c-443f-a65b-d21fe96a405b --- pbx/pbx_ael.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'pbx') diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c index f6371f1e4..7c9d6c120 100644 --- a/pbx/pbx_ael.c +++ b/pbx/pbx_ael.c @@ -95,7 +95,7 @@ struct ael_extension *new_exten(void); void destroy_extensions(struct ael_extension *exten); void set_priorities(struct ael_extension *exten); void add_extensions(struct ael_extension *exten); -void ast_compile_ael2(struct ast_context **local_contexts, struct ast_hashtab *local_table, struct pval *root); +int ast_compile_ael2(struct ast_context **local_contexts, struct ast_hashtab *local_table, struct pval *root); void destroy_pval(pval *item); void destroy_pval_item(pval *item); int is_float(char *arg ); @@ -137,7 +137,11 @@ static int pbx_load_module(void) if (errs == 0 && sem_err == 0) { ast_log(LOG_NOTICE, "AEL load process: checked config file name '%s'.\n", rfilename); local_table = ast_hashtab_create(11, ast_hashtab_compare_contexts, ast_hashtab_resize_java, ast_hashtab_newsize_java, ast_hashtab_hash_contexts, 0); - ast_compile_ael2(&local_contexts, local_table, parse_tree); + if (ast_compile_ael2(&local_contexts, local_table, parse_tree)) { + ast_log(LOG_ERROR, "AEL compile failed! Aborting.\n"); + destroy_pval(parse_tree); /* free up the memory */ + return AST_MODULE_LOAD_DECLINE; + } ast_log(LOG_NOTICE, "AEL load process: compiled config file name '%s'.\n", rfilename); ast_merge_contexts_and_delete(&local_contexts, local_table, registrar); -- cgit v1.2.3