diff --git a/src/frontend/logicexp.c b/src/frontend/logicexp.c index 2fe10dbc5..a80da6fb1 100644 --- a/src/frontend/logicexp.c +++ b/src/frontend/logicexp.c @@ -805,6 +805,11 @@ static int infix_to_postfix(char* infix, DSTRING * postfix_p) } } else if (ltok == ')') { rparen_count++; + if (rparen_count > lparen_count) { + fprintf(stderr, "ERROR (9a) mismatched rparen\n"); + status = 1; + goto err_return; + } while ( stack.top != -1 && !eq(stack.array[stack.top], "(") ) { ds_cat_printf(postfix_p, " %s", pop(&stack, &status)); if (status) {