diff --git a/ovn/lib/expr.c b/ovn/lib/expr.c index b50475245a4..8cfdf34fa6a 100644 --- a/ovn/lib/expr.c +++ b/ovn/lib/expr.c @@ -581,6 +581,11 @@ make_cmp(struct expr_context *ctx, f->symbol->name); goto exit; } + if (!cs->n_values) { + lexer_error(ctx->lexer, "Only == and != operators may be used " + "to compare a field against an empty value set."); + goto exit; + } if (cs->values[0].masked) { lexer_error(ctx->lexer, "Only == and != operators may be used " "with masked constants. Consider using subfields " diff --git a/tests/ovn.at b/tests/ovn.at index 886981d5183..71518d97db4 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -355,6 +355,8 @@ ip4.src == {1.2.3.4, $set1, $unknownset} => Syntax error at `$unknownset' expect eth.src == {$set3, badmac, 00:00:00:00:00:01} => Syntax error at `badmac' expecting constant. ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) => Parentheses nested too deeply. + +ct_label > $set4 => Only == and != operators may be used to compare a field against an empty value set. ]]) sed 's/ =>.*//' test-cases.txt > input.txt sed 's/.* => //' test-cases.txt > expout