The bogon will trigger the assertion in mpz_import_data: src/expression.c:418: constant_expr_alloc: Assertion `(((len) + (8) - 1) / (8)) > 0' failed. Signed-off-by: Florian Westphal <fw@xxxxxxxxx> --- src/expression.c | 2 +- .../bogons/nft-j-f/constant_expr_alloc_assert | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tests/shell/testcases/bogons/nft-j-f/constant_expr_alloc_assert diff --git a/src/expression.c b/src/expression.c index 156a66eb37f0..f230f5ad8935 100644 --- a/src/expression.c +++ b/src/expression.c @@ -494,7 +494,7 @@ struct expr *constant_expr_alloc(const struct location *loc, expr->flags = EXPR_F_CONSTANT | EXPR_F_SINGLETON; mpz_init2(expr->value, len); - if (data != NULL) + if (data != NULL && len) mpz_import_data(expr->value, data, byteorder, div_round_up(len, BITS_PER_BYTE)); diff --git a/tests/shell/testcases/bogons/nft-j-f/constant_expr_alloc_assert b/tests/shell/testcases/bogons/nft-j-f/constant_expr_alloc_assert new file mode 100644 index 000000000000..9c40030212ef --- /dev/null +++ b/tests/shell/testcases/bogons/nft-j-f/constant_expr_alloc_assert @@ -0,0 +1,38 @@ +{ + "nftables": [ + { + "table": { + "family": "ip", + "name": "t", + "handle": 0 + } + }, + { + "chain": { + "family": "ip", + "table": "t", + "name": "testchain", + "handle": 0 + } + }, + { + "map": { + "family": "ip", + "name": "testmap", + "table": "t", + "type": "ipv4_addr", + "handle": 0, + "map": "verdict", + "elem": [ + [ + { + "jump": { + "target": "" + } + } + ] + ] + } + } + ] +} -- 2.48.1