summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/bogons/nft-f/huge_binop_expr_chain_crash
Commit message (Collapse)AuthorAgeFilesLines
* src: do not allow to chain more than 16 binopsFlorian Westphal2023-12-221-0/+5
netlink_linearize.c has never supported more than 16 chained binops. Adding more is possible but overwrites the stack in netlink_gen_bitwise(). Add a recursion counter to catch this at eval stage. Its not enough to just abort once the counter hits NFT_MAX_EXPR_RECURSION. This is because there are valid test cases that exceed this. For example, evaluation of 1 | 2 will merge the constans, so even if there are a dozen recursive eval calls this will not end up with large binop chain post-evaluation. v2: allow more than 16 binops iff the evaluation function did constant-merging. Signed-off-by: Florian Westphal <fw@strlen.de>