Project

General

Profile

Actions

Bug #1246

closed

--filter expression parser accepts foo[bar]

Added by Simon Marchi over 4 years ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
03/19/2020
Due date:
% Done:

0%

Estimated time:

Description

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'

Internally, 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.

Actions #1

Updated by Simon Marchi over 1 year ago

I think this was fixed by:

https://github.com/lttng/lttng-tools/commit/4062406e2a957323852dca73a41e0239f6b9df03

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')  
Actions #2

Updated by Simon Marchi over 1 year ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF