From: Mathieu Desnoyers Date: Fri, 10 Mar 2017 21:49:42 +0000 (-0500) Subject: Fix: out of bound array access in filter code X-Git-Tag: v2.10.0-rc1~9 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f6753f2d6645625ff94d44490aa059960093ea65;p=lttng-ust.git Fix: out of bound array access in filter code Found by Coverity: *** CID 1372124: Memory - illegal accesses (OVERRUN) /liblttng-ust/lttng-filter.c: 139 in print_op() 133 134 const char *print_op(enum filter_op op) 135 { 136 if (op >= NR_FILTER_OPS) 137 return "UNKNOWN"; 138 else >>> CID 1372124: Memory - illegal accesses (OVERRUN) >>> Overrunning array "opnames" of 74 8-byte elements at element index 78 (byte offset 624) using index "op" (which evaluates to 78). 139 return opnames[op]; 140 } 141 142 static 143 int apply_field_reloc(struct lttng_event *event, Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/lttng-filter.c b/liblttng-ust/lttng-filter.c index c7412752..8114db60 100644 --- a/liblttng-ust/lttng-filter.c +++ b/liblttng-ust/lttng-filter.c @@ -129,6 +129,20 @@ static const char *opnames[] = { [ FILTER_OP_GET_CONTEXT_REF_STRING ] = "GET_CONTEXT_REF_STRING", [ FILTER_OP_GET_CONTEXT_REF_S64 ] = "GET_CONTEXT_REF_S64", [ FILTER_OP_GET_CONTEXT_REF_DOUBLE ] = "GET_CONTEXT_REF_DOUBLE", + + /* load userspace field ref */ + [ FILTER_OP_LOAD_FIELD_REF_USER_STRING ] = "LOAD_FIELD_REF_USER_STRING", + [ FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE ] = "LOAD_FIELD_REF_USER_SEQUENCE", + + /* + * load immediate star globbing pattern (literal string) + * from immediate. + */ + [ FILTER_OP_LOAD_STAR_GLOB_STRING ] = "LOAD_STAR_GLOB_STRING", + + /* globbing pattern binary operator: apply to */ + [ FILTER_OP_EQ_STAR_GLOB_STRING ] = "EQ_STAR_GLOB_STRING", + [ FILTER_OP_NE_STAR_GLOB_STRING ] = "NE_STAR_GLOB_STRING", }; const char *print_op(enum filter_op op)