evaluate: fix shift exponent underflow in concatenation evaluation
Pablo Neira Ayuso
maintainerPATCH 1/1 evaluate: fix shift exponent underflow in concatenation evaluation
There is an underflow of the index that iterates over the concatenation:
../include/datatype.h:292:15: runtime error: shift exponent 4294967290 is too large for 32-bit type 'unsigned int'
set the datatype to invalid, which is fine when evaluating the concatenation
Update b8e1940aa190 ("tests: add a test case for map update from packet path with concat") so it does not need a workaround to work.
Signed-off-by Pablo Neira Ayuso <[email protected]>
---
Prepending meta l4proto tcp still fails, I'm still looking into this:
meta l4proto tcp update @pinned { ip saddr . ct original proto-dst timeout 1m30s : ip daddr . tcp dport }src/evaluate.c | 2 +- .../testcases/maps/dumps/typeof_maps_concat_update_0.nft | 2 +- tests/shell/testcases/maps/typeof_maps_concat_update_0 | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
src/evaluate.c +1 -1
@@ -1357,7 +1357,7 @@ static int expr_evaluate_concat(struct eval_ctx *ctx, struct expr **expr) dsize = key->len; bo = key->byteorder; off--; - }else if (dtype ==NULL ) { + }else if (dtype ==NULL || off ==0 ) { tmp =datatype_lookup (TYPE_INVALID ); }else { tmp =concat_subtype_lookup (type, --off);
tests/shell/testcases/maps/dumps/typeof_maps_concat_update_0.nft +1 -1
@@ -1,6 +1,6 @@ table ip foo { map pinned { - typeof ip daddr . tcp dport : ip daddr . tcp dport + typeof ip saddr . ct original proto-dst : ip daddr . tcp dport size 65535 flags dynamic,timeout timeout 6m
tests/shell/testcases/maps/typeof_maps_concat_update_0 +2 -2
@@ -4,13 +4,13 @@ EXPECTED="table ip foo { map pinned { - typeof ip daddr . tcp dport : ip daddr . tcp dport + typeof ip saddr . ct original proto-dst : ip daddr . tcp dport size 65535 flags dynamic,timeout timeout 6m } chain pr { - meta l4proto tcp update @pinned { ip saddr . ct original proto-dst timeout 1m30s : ip daddr . tcp dport } + update @pinned { ip saddr . ct original proto-dst timeout 1m30s : ip daddr . tcp dport } } }"
Signature · 1 line
2.30.2