--filter expression parser accepts foo[bar]
According to the doc, it is only possible to access arrays elements using positive literal integer numbers. However, the parser accepts:
./lttng enable-event -u -a --filter 'allo[toi] == 2'
create_load_expression creates a
ir_load_expression_op node with type
IR_LOAD_EXPRESSION_GET_INDEX. However, the associated index value is the value of the pointer to the
toi string, interpreted as an unsigned integer by
visit_node_load_expression when generating the bytecode.
I think this user error should be caught earlier and result in an error on the client side.
Updated by Simon Marchi 7 months ago
I think this was fixed by:
With today's master, I get:
+ ./src/bin/lttng/lttng enable-event -u -a --filter 'allo[toi] == 2' [error] Expecting constant index in array expression Generate IR error Error: All events: Invalid filter bytecode (channel channel0, session auto-20230301-114605, filter 'allo[toi] == 2')