aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2021-06-09 14:44:42 -0700
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2021-06-22 17:35:22 -0400
commit17aeb3190272c9c2897746a7ca37b2eb084cabf3 (patch)
tree626da521754dce3e3daa4c7c603d91fb9d32c274
parent62823da1bd46f24e2b498513a809011dfe16cd9b (diff)
downloadlibtraceevent-17aeb3190272c9c2897746a7ca37b2eb084cabf3.tar.gz
libtraceevent: Workaround address sanitizer warnings
Reading a character 1 into an empty string (ie s = ""; ... = s[1]) triggers an address sanitizer warning on reading of an unitilized value. Reorder the code to avoid this. Link: https://lore.kernel.org/linux-trace-devel/20210609214442.523914-1-irogers@google.com Signed-off-by: Ian Rogers <irogers@google.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--src/event-parse.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/event-parse.c b/src/event-parse.c
index 1217491..9915cb4 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -2039,7 +2039,7 @@ out_free:
static int get_op_prio(char *op)
{
- if (!op[1]) {
+ if (strlen(op) == 1) {
switch (op[0]) {
case '~':
case '!':
@@ -2117,10 +2117,6 @@ process_op(struct tep_event *event, struct tep_print_arg *arg, char **tok)
if (arg->type == TEP_PRINT_OP && !arg->op.left) {
/* handle single op */
- if (token[1]) {
- do_warning_event(event, "bad op token %s", token);
- goto out_free;
- }
switch (token[0]) {
case '~':
case '!':
@@ -2132,6 +2128,10 @@ process_op(struct tep_event *event, struct tep_print_arg *arg, char **tok)
goto out_free;
}
+ if (token[1]) {
+ do_warning_event(event, "bad op token %s", token);
+ goto out_free;
+ }
/* make an empty left */
left = alloc_arg();