diff options
author | João Valverde <j@v6e.pt> | 2022-03-23 10:57:14 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2022-03-23 11:04:41 +0000 |
commit | 2fc8c0e36bb31fc9ded8d0eba230192a9c466041 (patch) | |
tree | 09da5b7d6aead299b5cb9cc9ef94af56fe1a111a /epan/dfilter | |
parent | 0335ebdc3ac28a09733b8e1f9e90944be2fba2ab (diff) |
dfilter: Handle a bitwise expr on the RHS
Diffstat (limited to 'epan/dfilter')
-rw-r--r-- | epan/dfilter/semcheck.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/epan/dfilter/semcheck.c b/epan/dfilter/semcheck.c index 21075cf24f..7986e6df34 100644 --- a/epan/dfilter/semcheck.c +++ b/epan/dfilter/semcheck.c @@ -721,6 +721,19 @@ again: else if (type2 == STTYPE_PCRE) { ws_assert(st_op == TEST_OP_MATCHES); } + else if (type2 == STTYPE_BITWISE) { + ftype2 = check_bitwise_operation(dfw, st_arg2); + + if (!compatible_ftypes(ftype1, ftype2)) { + FAIL(dfw, "%s and %s are not of compatible types.", + stnode_todisplay(st_arg1), stnode_todisplay(st_arg2)); + } + + if (!can_func(ftype2)) { + FAIL(dfw, "%s (type=%s) cannot participate in specified comparison.", + stnode_todisplay(st_arg2), ftype_pretty_name(ftype2)); + } + } else { ws_assert_not_reached(); } @@ -801,6 +814,19 @@ again: else if (type2 == STTYPE_PCRE) { ws_assert(st_op == TEST_OP_MATCHES); } + else if (type2 == STTYPE_BITWISE) { + ftype2 = check_bitwise_operation(dfw, st_arg2); + + if (!compatible_ftypes(FT_BYTES, ftype2)) { + FAIL(dfw, "%s and %s are not of compatible types.", + stnode_todisplay(st_arg1), stnode_todisplay(st_arg2)); + } + + if (!can_func(ftype2)) { + FAIL(dfw, "%s (type=%s) cannot participate in specified comparison.", + stnode_todisplay(st_arg2), ftype_pretty_name(ftype2)); + } + } else { ws_assert_not_reached(); } @@ -904,6 +930,19 @@ again: else if (type2 == STTYPE_PCRE) { ws_assert(st_op == TEST_OP_MATCHES); } + else if (type2 == STTYPE_BITWISE) { + ftype2 = check_bitwise_operation(dfw, st_arg2); + + if (!compatible_ftypes(ftype1, ftype2)) { + FAIL(dfw, "%s and %s are not of compatible types.", + stnode_todisplay(st_arg1), stnode_todisplay(st_arg2)); + } + + if (!can_func(ftype2)) { + FAIL(dfw, "%s (type=%s) cannot participate in specified comparison.", + stnode_todisplay(st_arg2), ftype_pretty_name(ftype2)); + } + } else { ws_assert_not_reached(); } |