mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 06:48:47 +02:00
Stop parsing user func early if possible.
This commit is contained in:
@@ -168,8 +168,8 @@ static expr_node *expr_node_free_list = NULL;
|
||||
#define STACK_ARGS_MAX 5
|
||||
|
||||
/* Maximum parse level before we bail (to avoid SEGV from filling stack)*/
|
||||
|
||||
#define MAX_PARSE_LEVEL 2000
|
||||
|
||||
static int parse_level_high_water = 0;
|
||||
#define CHECK_PARSE_LEVEL() do { if (level > parse_level_high_water) { parse_level_high_water = level; if (level > MAX_PARSE_LEVEL) { *r = E_OP_STK_OVER; return NULL; } } } while(0)
|
||||
|
||||
@@ -199,7 +199,6 @@ static UserFunc *CurrentUserFunc = NULL;
|
||||
/* How many expr_node objects to allocate at a time */
|
||||
#define ALLOC_CHUNK 64
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* alloc_expr_node - allocate an expr_node object */
|
||||
@@ -586,7 +585,7 @@ debug_exit_userfunc(expr_node *node, Value *ans, int r, Value *locals, int nargs
|
||||
/* eval_userfunc - evaluate a user-defined function */
|
||||
/* */
|
||||
/* This function sets up a local value array by evaluating */
|
||||
/* all of its children, and then evaluated the expr_node */
|
||||
/* all of its children, and then evaluates the expr_node */
|
||||
/* tree associated with the user-defined function. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
|
||||
@@ -115,17 +115,6 @@ int DoFset(ParsePtr p)
|
||||
}
|
||||
orig_namelen = buf.len;
|
||||
|
||||
/* Should be followed by '(' */
|
||||
c = ParseNonSpaceChar(p, &r, 0);
|
||||
if (r) {
|
||||
DBufFree(&buf);
|
||||
return r;
|
||||
}
|
||||
if (c != '(') {
|
||||
DBufFree(&buf);
|
||||
return E_PARSE_ERR;
|
||||
}
|
||||
|
||||
/* Convert to lower-case */
|
||||
strtolower(DBufValue(&buf));
|
||||
|
||||
@@ -141,6 +130,18 @@ int DoFset(ParsePtr p)
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
/* Should be followed by '(' */
|
||||
c = ParseNonSpaceChar(p, &r, 0);
|
||||
if (r) {
|
||||
DBufFree(&buf);
|
||||
return r;
|
||||
}
|
||||
if (c != '(') {
|
||||
DBufFree(&buf);
|
||||
return E_PARSE_ERR;
|
||||
}
|
||||
|
||||
func = NEW(UserFunc);
|
||||
if (!func) {
|
||||
DBufFree(&buf);
|
||||
|
||||
Reference in New Issue
Block a user