dfilter: Check if type supports unary minus

Fix crash for types that do not support unary minus.

Fixes #18750.
This commit is contained in:
João Valverde 2022-12-21 14:41:20 +00:00
parent c654566fc6
commit 263bda375c
1 changed files with 4 additions and 0 deletions

View File

@ -1184,6 +1184,10 @@ check_arithmetic_expr(dfwork_t *dfw, stnode_t *st_node, ftenum_t lhs_ftype)
if (st_op == STNODE_OP_UNARY_MINUS) {
ftype1 = check_arithmetic_entity(dfw, st_arg1, lhs_ftype);
if (!ftype_can_unary_minus(ftype1)) {
FAIL(dfw, st_arg1, "%s cannot %s.",
ftype_name(ftype1), stnode_todisplay(st_node));
}
if (stnode_type_id(st_arg1) == STTYPE_FVALUE) {
/* Pre-compute constant unary minus result */
char *err_msg;