From: Mathieu Desnoyers Date: Mon, 25 May 2020 20:15:40 +0000 (-0400) Subject: Fix: validate that array expression contains constant X-Git-Tag: v2.12.4~18 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=356bfe7b6e03d3b61b44514674e60d1b3036693e;p=lttng-tools.git Fix: validate that array expression contains constant Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau Change-Id: Ic4f9b178d918b2c7c9dd27bc6a30c1798a171727 --- diff --git a/src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c b/src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c index 11c6b610c..1ea6fe38f 100644 --- a/src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c +++ b/src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c @@ -244,6 +244,11 @@ struct ir_load_expression *create_load_expression(struct filter_node *node) bracket_node != NULL; bracket_node = bracket_node->u.expression.next_bracket) { prev_op = load_exp_op; + if (bracket_node->type != NODE_EXPRESSION || + bracket_node->u.expression.type != AST_EXP_CONSTANT) { + fprintf(stderr, "[error] Expecting constant index in array expression\n"); + goto error; + } load_exp_op = calloc(sizeof(struct ir_load_expression_op), 1); if (!load_exp_op) goto error;