Fix: validate that array expression contains constant
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 25 May 2020 20:15:40 +0000 (16:15 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 11 May 2021 17:27:01 +0000 (13:27 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ic4f9b178d918b2c7c9dd27bc6a30c1798a171727

src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c

index a189c4e9bc904e387e59c0336e8fb7677e8715b0..d2165e640204934304882239206b8b7abf57b716 100644 (file)
@@ -254,6 +254,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;
This page took 0.025834 seconds and 4 git commands to generate.