[asterisk-commits] murf: branch 1.6.1 r162082 - in /branches/1.6.1: ./ include/asterisk/ res/ael/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 9 11:32:50 CST 2008
Author: murf
Date: Tue Dec 9 11:32:49 2008
New Revision: 162082
URL: http://svn.digium.com/view/asterisk?view=rev&rev=162082
Log:
Merged revisions 162079 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r162079 | murf | 2008-12-09 10:18:03 -0700 (Tue, 09 Dec 2008) | 53 lines
Merged revisions 162013 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r162013 | murf | 2008-12-09 09:31:55 -0700 (Tue, 09 Dec 2008) | 45 lines
(closes issue #14019)
Reported by: ckjohnsonme
Patches:
14019.diff uploaded by murf (license 17)
Tested by: ckjohnsonme, murf
This crash was the result of a few small errors that
would combine in 64-bit land to result in a crash.
32-bit land might have seen these combine to mysteriously
drop the args to an application call, in certain
circumstances.
Also, in trying to find this bug, I spotted
a situation in the flex input, where, in passing
back a 'word' to the parser, it would allocate
a buffer larger than necessary. I changed the
usage in such situations, so that strdup was
not used, but rather, an ast_malloc, followed
by ast_copy_string.
I removed a field from the pval struct, in
u2, that was never getting used, and set in
one spot in the code. I believe it was an
artifact of a previous fix to make switch
cases work invisibly with extens.
And, for goto's I removed a '!' from
before a strcmp, that has been there
since the initial merging of AEL2, that
might prevent the proper target of a
goto from being found. This was pretty
harmless on its own, as it would just
louse up a consistency check for users.
Many thanks to ckjohnsonme for providing
a simplified and complete set of information
about the bug, that helped considerably in
finding and fixing the problem.
Now, to get aelparse up and running again
in trunk, and out of its "horribly broken" state,
so I can run the regression suite!
........
................
Modified:
branches/1.6.1/ (props changed)
branches/1.6.1/include/asterisk/pval.h
branches/1.6.1/res/ael/ael.flex
branches/1.6.1/res/ael/ael_lex.c
branches/1.6.1/res/ael/pval.c
Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.1/include/asterisk/pval.h
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/include/asterisk/pval.h?view=diff&rev=162082&r1=162081&r2=162082
==============================================================================
--- branches/1.6.1/include/asterisk/pval.h (original)
+++ branches/1.6.1/include/asterisk/pval.h Tue Dec 9 11:32:49 2008
@@ -69,7 +69,6 @@
struct pval *statements; /* used in case, default, catch, while's statement, CONTEXT elements, GLOBALS */
char *val; /* used in VARDEC */
char *for_test; /* used in FOR */
- int label_in_case; /* a boolean for LABELs */
struct pval *goto_target; /* used in GOTO */
} u2;
Modified: branches/1.6.1/res/ael/ael.flex
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/res/ael/ael.flex?view=diff&rev=162082&r1=162081&r2=162082
==============================================================================
--- branches/1.6.1/res/ael/ael.flex (original)
+++ branches/1.6.1/res/ael/ael.flex Tue Dec 9 11:32:49 2008
@@ -308,8 +308,8 @@
/* a non-word constituent char, like a space, tab, curly, paren, etc */
char c = yytext[yyleng-1];
STORE_POS;
- yylval->str = strdup(yytext);
- yylval->str[yyleng-1] = 0;
+ yylval->str = ast_malloc(yyleng);
+ ast_copy_string(yylval->str, yytext, yyleng);
unput(c); /* put this ending char back in the stream */
BEGIN(0);
return word;
@@ -321,7 +321,8 @@
STORE_LOC;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
parencount2--;
@@ -348,7 +349,8 @@
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n",
my_file, my_lineno, my_col, c);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
yymore();
@@ -360,7 +362,8 @@
STORE_LOC;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
parencount3--;
@@ -387,7 +390,8 @@
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n",
my_file, my_lineno, my_col, c);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
yymore();
@@ -406,7 +410,8 @@
STORE_LOC;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
prev_word = 0;
return word;
}
@@ -415,8 +420,8 @@
yymore();
} else {
STORE_LOC;
- yylval->str = strdup(yytext);
- yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
+ yylval->str = ast_malloc(yyleng);
+ ast_copy_string(yylval->str, yytext, yyleng);
unput(')');
BEGIN(0);
return word;
@@ -438,7 +443,8 @@
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n",
my_file, my_lineno, my_col, c);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
yymore();
@@ -466,7 +472,8 @@
STORE_LOC;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno, my_col);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
@@ -478,7 +485,8 @@
BEGIN(0);
if ( !strcmp(yytext, ")") )
return RP;
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng);
+ ast_copy_string(yylval->str, yytext, yyleng);
yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
unput(')');
return word;
@@ -486,14 +494,14 @@
}
<argg>{NOARGG}\, {
- if( parencount != 0) { /* printf("Folding in a comma!\n"); */
+ if( parencount != 0) { /* ast_log(LOG_NOTICE,"Folding in a comma!\n"); */
yymore();
} else {
STORE_LOC;
if( !strcmp(yytext,"," ) )
return COMMA;
- yylval->str = strdup(yytext);
- yylval->str[yyleng-1] = '\0';
+ yylval->str = ast_malloc(yyleng);
+ ast_copy_string(yylval->str, yytext, yyleng);
unput(',');
return word;
}
@@ -505,7 +513,8 @@
STORE_LOC;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n", my_file, my_lineno, my_col, c);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
yymore();
@@ -528,7 +537,8 @@
STORE_LOC;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n", my_file, my_lineno, my_col, c);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
yymore();
@@ -536,8 +546,8 @@
<semic>{NOSEMIC}; {
STORE_LOC;
- yylval->str = strdup(yytext);
- yylval->str[yyleng-1] = '\0';
+ yylval->str = ast_malloc(yyleng);
+ ast_copy_string(yylval->str, yytext, yyleng);
unput(';');
BEGIN(0);
return word;
Modified: branches/1.6.1/res/ael/ael_lex.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/res/ael/ael_lex.c?view=diff&rev=162082&r1=162081&r2=162082
==============================================================================
--- branches/1.6.1/res/ael/ael_lex.c (original)
+++ branches/1.6.1/res/ael/ael_lex.c Tue Dec 9 11:32:49 2008
@@ -1613,8 +1613,8 @@
/* a non-word constituent char, like a space, tab, curly, paren, etc */
char c = yytext[yyleng-1];
STORE_POS;
- yylval->str = strdup(yytext);
- yylval->str[yyleng-1] = 0;
+ yylval->str = ast_malloc(yyleng);
+ ast_copy_string(yylval->str, yytext, yyleng);
unput(c); /* put this ending char back in the stream */
BEGIN(0);
return word;
@@ -1629,7 +1629,8 @@
STORE_LOC;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
parencount2--;
@@ -1644,7 +1645,7 @@
case 59:
/* rule 59 can match eol */
YY_RULE_SETUP
-#line 336 "ael.flex"
+#line 337 "ael.flex"
{
char c = yytext[yyleng-1];
if (c == '{')
@@ -1656,7 +1657,7 @@
case 60:
/* rule 60 can match eol */
YY_RULE_SETUP
-#line 344 "ael.flex"
+#line 345 "ael.flex"
{
char c = yytext[yyleng-1];
if ( pbcpop2(c)) { /* error */
@@ -1664,7 +1665,8 @@
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n",
my_file, my_lineno, my_col, c);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
yymore();
@@ -1673,13 +1675,14 @@
case 61:
/* rule 61 can match eol */
YY_RULE_SETUP
-#line 358 "ael.flex"
+#line 360 "ael.flex"
{
if ( pbcpop3(']') ) { /* error */
STORE_LOC;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
parencount3--;
@@ -1694,7 +1697,7 @@
case 62:
/* rule 62 can match eol */
YY_RULE_SETUP
-#line 375 "ael.flex"
+#line 378 "ael.flex"
{
char c = yytext[yyleng-1];
if (c == '[')
@@ -1706,7 +1709,7 @@
case 63:
/* rule 63 can match eol */
YY_RULE_SETUP
-#line 383 "ael.flex"
+#line 386 "ael.flex"
{
char c = yytext[yyleng-1];
if ( pbcpop3(c)) { /* error */
@@ -1714,7 +1717,8 @@
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n",
my_file, my_lineno, my_col, c);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
yymore();
@@ -1730,13 +1734,14 @@
case 64:
/* rule 64 can match eol */
YY_RULE_SETUP
-#line 404 "ael.flex"
+#line 408 "ael.flex"
{
if ( pbcpop(')') ) { /* error */
STORE_LOC;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression: %s !\n", my_file, my_lineno, my_col, yytext);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
prev_word = 0;
return word;
}
@@ -1745,8 +1750,8 @@
yymore();
} else {
STORE_LOC;
- yylval->str = strdup(yytext);
- yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
+ yylval->str = ast_malloc(yyleng);
+ ast_copy_string(yylval->str, yytext, yyleng);
unput(')');
BEGIN(0);
return word;
@@ -1756,7 +1761,7 @@
case 65:
/* rule 65 can match eol */
YY_RULE_SETUP
-#line 426 "ael.flex"
+#line 431 "ael.flex"
{
char c = yytext[yyleng-1];
if (c == '(')
@@ -1768,7 +1773,7 @@
case 66:
/* rule 66 can match eol */
YY_RULE_SETUP
-#line 434 "ael.flex"
+#line 439 "ael.flex"
{
char c = yytext[yyleng-1];
if ( pbcpop(c)) { /* error */
@@ -1776,7 +1781,8 @@
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n",
my_file, my_lineno, my_col, c);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
yymore();
@@ -1793,7 +1799,7 @@
case 67:
/* rule 67 can match eol */
YY_RULE_SETUP
-#line 456 "ael.flex"
+#line 462 "ael.flex"
{
char c = yytext[yyleng-1];
if (c == '(')
@@ -1805,13 +1811,14 @@
case 68:
/* rule 68 can match eol */
YY_RULE_SETUP
-#line 464 "ael.flex"
+#line 470 "ael.flex"
{
if ( pbcpop(')') ) { /* error */
STORE_LOC;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched ')' in expression!\n", my_file, my_lineno, my_col);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
@@ -1823,7 +1830,8 @@
BEGIN(0);
if ( !strcmp(yytext, ")") )
return RP;
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng);
+ ast_copy_string(yylval->str, yytext, yyleng);
yylval->str[yyleng-1] = '\0'; /* trim trailing ')' */
unput(')');
return word;
@@ -1833,16 +1841,16 @@
case 69:
/* rule 69 can match eol */
YY_RULE_SETUP
-#line 488 "ael.flex"
-{
- if( parencount != 0) { /* printf("Folding in a comma!\n"); */
+#line 496 "ael.flex"
+{
+ if( parencount != 0) { /* ast_log(LOG_NOTICE,"Folding in a comma!\n"); */
yymore();
} else {
STORE_LOC;
if( !strcmp(yytext,"," ) )
return COMMA;
- yylval->str = strdup(yytext);
- yylval->str[yyleng-1] = '\0';
+ yylval->str = ast_malloc(yyleng);
+ ast_copy_string(yylval->str, yytext, yyleng);
unput(',');
return word;
}
@@ -1851,14 +1859,15 @@
case 70:
/* rule 70 can match eol */
YY_RULE_SETUP
-#line 502 "ael.flex"
+#line 510 "ael.flex"
{
char c = yytext[yyleng-1];
if ( pbcpop(c) ) { /* error */
STORE_LOC;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n", my_file, my_lineno, my_col, c);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
yymore();
@@ -1872,7 +1881,7 @@
case 71:
/* rule 71 can match eol */
YY_RULE_SETUP
-#line 519 "ael.flex"
+#line 528 "ael.flex"
{
char c = yytext[yyleng-1];
yymore();
@@ -1882,14 +1891,15 @@
case 72:
/* rule 72 can match eol */
YY_RULE_SETUP
-#line 525 "ael.flex"
+#line 534 "ael.flex"
{
char c = yytext[yyleng-1];
if ( pbcpop(c) ) { /* error */
STORE_LOC;
ast_log(LOG_ERROR,"File=%s, line=%d, column=%d: Mismatched '%c' in expression!\n", my_file, my_lineno, my_col, c);
BEGIN(0);
- yylval->str = strdup(yytext);
+ yylval->str = ast_malloc(yyleng+1);
+ ast_copy_string(yylval->str, yytext, yyleng+1);
return word;
}
yymore();
@@ -1898,11 +1908,11 @@
case 73:
/* rule 73 can match eol */
YY_RULE_SETUP
-#line 537 "ael.flex"
+#line 547 "ael.flex"
{
STORE_LOC;
- yylval->str = strdup(yytext);
- yylval->str[yyleng-1] = '\0';
+ yylval->str = ast_malloc(yyleng);
+ ast_copy_string(yylval->str, yytext, yyleng);
unput(';');
BEGIN(0);
return word;
@@ -1911,7 +1921,7 @@
case 74:
/* rule 74 can match eol */
YY_RULE_SETUP
-#line 546 "ael.flex"
+#line 556 "ael.flex"
{
char fnamebuf[1024],*p1,*p2;
int glob_ret;
@@ -1964,7 +1974,7 @@
case YY_STATE_EOF(curlystate):
case YY_STATE_EOF(wordstate):
case YY_STATE_EOF(brackstate):
-#line 591 "ael.flex"
+#line 601 "ael.flex"
{
char fnamebuf[2048];
if (include_stack_index > 0 && include_stack[include_stack_index-1].globbuf_pos < include_stack[include_stack_index-1].globbuf.gl_pathc-1) {
@@ -1999,10 +2009,10 @@
YY_BREAK
case 75:
YY_RULE_SETUP
-#line 623 "ael.flex"
+#line 633 "ael.flex"
ECHO;
YY_BREAK
-#line 2005 "ael_lex.c"
+#line 2015 "ael_lex.c"
case YY_END_OF_BUFFER:
{
@@ -3175,7 +3185,7 @@
#define YYTABLES_NAME "yytables"
-#line 623 "ael.flex"
+#line 633 "ael.flex"
Modified: branches/1.6.1/res/ael/pval.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/res/ael/pval.c?view=diff&rev=162082&r1=162081&r2=162082
==============================================================================
--- branches/1.6.1/res/ael/pval.c (original)
+++ branches/1.6.1/res/ael/pval.c Tue Dec 9 11:32:49 2008
@@ -695,7 +695,7 @@
regex_t preg;
/* simple case, they match exactly, the pattern and exten name */
- if (!strcmp(pattern,exten) == 0)
+ if (strcmp(pattern,exten) == 0)
return 1;
if (pattern[0] == '_') {
@@ -3441,7 +3441,7 @@
pr->type = AEL_APPCALL;
p->u2.goto_target = get_goto_target(p);
if( p->u2.goto_target ) {
- p->u3.goto_target_in_case = p->u2.goto_target->u2.label_in_case = label_inside_case(p->u2.goto_target);
+ p->u3.goto_target_in_case = label_inside_case(p->u2.goto_target);
}
if (!p->u1.list->next) /* just one */ {
@@ -5788,50 +5788,3 @@
return head;
}
-#ifdef HERE_BY_MISTAKE_I_THINK
-static char *config = "extensions.ael";
-int do_pbx_load_module(void)
-{
- int errs, sem_err, sem_warn, sem_note;
- char *rfilename;
- struct ast_context *local_contexts=NULL, *con;
- struct pval *parse_tree;
-
- ast_log(LOG_NOTICE, "Starting AEL load process.\n");
- if (config[0] == '/')
- rfilename = (char *)config;
- else {
- rfilename = alloca(strlen(config) + strlen(ast_config_AST_CONFIG_DIR) + 2);
- sprintf(rfilename, "%s/%s", ast_config_AST_CONFIG_DIR, config);
- }
- ast_log(LOG_NOTICE, "AEL load process: calculated config file name '%s'.\n", rfilename);
-
- if (access(rfilename,R_OK) != 0) {
- ast_log(LOG_NOTICE, "File %s not found; AEL declining load\n", rfilename);
- return AST_MODULE_LOAD_DECLINE;
- }
-
- parse_tree = ael2_parse(rfilename, &errs);
- ast_log(LOG_DEBUG, "AEL load process: parsed config file name '%s'.\n", rfilename);
- ael2_semantic_check(parse_tree, &sem_err, &sem_warn, &sem_note);
- if (errs == 0 && sem_err == 0) {
- ast_log(LOG_DEBUG, "AEL load process: checked config file name '%s'.\n", rfilename);
- ast_compile_ael2(&local_contexts, parse_tree);
- ast_log(LOG_DEBUG, "AEL load process: compiled config file name '%s'.\n", rfilename);
-
- ast_merge_contexts_and_delete(&local_contexts, registrar);
- ast_log(LOG_DEBUG, "AEL load process: merged config file name '%s'.\n", rfilename);
- for (con = ast_walk_contexts(NULL); con; con = ast_walk_contexts(con))
- ast_context_verify_includes(con);
- ast_log(LOG_DEBUG, "AEL load process: verified config file name '%s'.\n", rfilename);
- } else {
- ast_log(LOG_ERROR, "Sorry, but %d syntax errors and %d semantic errors were detected. It doesn't make sense to compile.\n", errs, sem_err);
- destroy_pval(parse_tree); /* free up the memory */
- return AST_MODULE_LOAD_FAILURE;
- }
- destroy_pval(parse_tree); /* free up the memory */
-
- return AST_MODULE_LOAD_SUCCESS;
-}
-#endif
-
More information about the asterisk-commits
mailing list