Bug#332804: fix infinite loop in parsing malformed functions (e.g. "ipmt(1:2:)").

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13416 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled
2006-02-28 01:26:43 +00:00
parent 9255df9093
commit 83aeccb25e
2 changed files with 8 additions and 6 deletions

View File

@@ -1,5 +1,8 @@
2006-02-27 Joshua Sled <jsled@asynchronous.org>
* src/calculation/expression_parser.c (primary_exp): Fix infinite
loop in parsing malformed functions (e.g. "ipmt(1:2:)"). Bug#332804.
* src/app-utils/gnc-exp-parser.c (func_op): No longer crashes on
an invalid formula, though it's also not very clear what's going
on. Basically fixes Bug#137885.

View File

@@ -832,9 +832,9 @@ next_token (parser_env_ptr pe)
*nstr = EOS;
if ( funcFlag ) {
add_token( pe, FN_TOKEN );
add_token(pe, FN_TOKEN);
} else {
add_token (pe, VAR_TOKEN);
add_token(pe, VAR_TOKEN);
}
}
@@ -1147,13 +1147,12 @@ primary_exp (parser_env_ptr pe)
assignment_op(pe);
if ( pe->error_code )
return;
funcArgCount++;
if ( pe->Token == ')' ) {
if (!pe->Token || pe->Token == ')') {
break;
}
funcArgCount++;
next_token(pe);
} while ( pe->Token != ARG_TOKEN );
} while (pe->Token != ARG_TOKEN);
if ( pe->Token != ')' ) {
add_token( pe, EOS );