Commit efd10742 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

widl: Issue an error instead of crashing for dividing by zero in a constant expression.

parent c46fcfb3
......@@ -1237,7 +1237,11 @@ static expr_t *make_expr2(enum expr_type type, expr_t *expr1, expr_t *expr2)
e->cval = expr1->cval * expr2->cval;
break;
case EXPR_DIV:
e->cval = expr1->cval / expr2->cval;
if (expr2->cval == 0) {
error_loc("divide by zero in expression\n");
e->cval = 0;
} else
e->cval = expr1->cval / expr2->cval;
break;
case EXPR_OR:
e->cval = expr1->cval | expr2->cval;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment