Fix: context alignment not properly handled
[lttng-ust.git] / liblttng-ust / lttng-filter-interpreter.c
index 1f43decee2e32414cb71b3f06e2cd2e9d3afbbaf..df4add225dbb2585548b6bcb740a4aaa026772b8 100644 (file)
@@ -58,8 +58,8 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type)
        for (;;) {
                int escaped_r0 = 0;
 
-               if (unlikely(p - estack_bx(stack, top)->u.s.str > estack_bx(stack, top)->u.s.seq_len || *p == '\0')) {
-                       if (q - estack_ax(stack, top)->u.s.str > estack_ax(stack, top)->u.s.seq_len || *q == '\0') {
+               if (unlikely(p - estack_bx(stack, top)->u.s.str >= estack_bx(stack, top)->u.s.seq_len || *p == '\0')) {
+                       if (q - estack_ax(stack, top)->u.s.str >= estack_ax(stack, top)->u.s.seq_len || *q == '\0') {
                                return 0;
                        } else {
                                if (estack_ax(stack, top)->u.s.literal) {
@@ -70,8 +70,8 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type)
                                return -1;
                        }
                }
-               if (unlikely(q - estack_ax(stack, top)->u.s.str > estack_ax(stack, top)->u.s.seq_len || *q == '\0')) {
-                       if (p - estack_bx(stack, top)->u.s.str > estack_bx(stack, top)->u.s.seq_len || *p == '\0') {
+               if (unlikely(q - estack_ax(stack, top)->u.s.str >= estack_ax(stack, top)->u.s.seq_len || *q == '\0')) {
+                       if (p - estack_bx(stack, top)->u.s.str >= estack_bx(stack, top)->u.s.seq_len || *p == '\0') {
                                return 0;
                        } else {
                                if (estack_bx(stack, top)->u.s.literal) {
@@ -176,7 +176,6 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                const char *filter_stack_data)
 {
        struct bytecode_runtime *bytecode = filter_data;
-       struct lttng_ctx *ctx = bytecode->p.bc->enabler->chan->ctx;
        void *pc, *next_pc, *start_pc;
        int ret = -EINVAL;
        uint64_t retval = 0;
@@ -864,7 +863,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
 
                        dbg_printf("get context ref offset %u type string\n",
                                ref->offset);
-                       ctx_field = &ctx->fields[ref->offset];
+                       ctx_field = &lttng_static_ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx);
                        estack_ax(stack, top)->u.s.str = v.str;
@@ -889,7 +888,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
 
                        dbg_printf("get context ref offset %u type s64\n",
                                ref->offset);
-                       ctx_field = &ctx->fields[ref->offset];
+                       ctx_field = &lttng_static_ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx);
                        estack_ax_v = v.s64;
@@ -907,7 +906,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
 
                        dbg_printf("get context ref offset %u type double\n",
                                ref->offset);
-                       ctx_field = &ctx->fields[ref->offset];
+                       ctx_field = &lttng_static_ctx->fields[ref->offset];
                        ctx_field->get_value(ctx_field, &v);
                        estack_push(stack, top, ax, bx);
                        memcpy(&estack_ax(stack, top)->u.d, &v.d, sizeof(struct literal_double));
This page took 0.023997 seconds and 4 git commands to generate.