X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Ffilter%2Ffilter-visitor-generate-ir.c;h=1ea6fe38fd60853587bd20c17159562eb2049909;hb=356bfe7b6e03d3b61b44514674e60d1b3036693e;hp=a189c4e9bc904e387e59c0336e8fb7677e8715b0;hpb=116d3c01872d62ee86bdbd0aea575b12fbc9c272;p=lttng-tools.git 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 a189c4e9b..1ea6fe38f 100644 --- a/src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c +++ b/src/lib/lttng-ctl/filter/filter-visitor-generate-ir.c @@ -3,20 +3,10 @@ * * LTTng filter generate intermediate representation * - * Copyright 2012 - Mathieu Desnoyers + * Copyright 2012 Mathieu Desnoyers * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License, version 2.1 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: LGPL-2.1-only * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include @@ -87,7 +77,7 @@ enum ir_load_string_type get_literal_string_type(const char *string) } static -struct ir_op *make_op_load_string(char *string, enum ir_side side) +struct ir_op *make_op_load_string(const char *string, enum ir_side side) { struct ir_op *op; @@ -197,7 +187,7 @@ struct ir_load_expression *create_load_expression(struct filter_node *node) { struct ir_load_expression *load_exp; struct ir_load_expression_op *load_exp_op, *prev_op; - char *str; + const char *str; /* Get forward chain. */ node = load_expression_get_forward_chain(node); @@ -254,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;