X-Git-Url: http://git.lttng.org/?p=lttng-modules.git;a=blobdiff_plain;f=lttng-filter-interpreter.c;h=b1e5ba7360261a651386ebfa4485093a4a566237;hp=5bf0bd6074719ef59cf5dc8a2fe57f4cc0f5e7e7;hb=ea13ec960f55bac1d08e5ec3523797ccdbde573b;hpb=e16c054bb621df50a1710dcd9d1d613f13ef52d2 diff --git a/lttng-filter-interpreter.c b/lttng-filter-interpreter.c index 5bf0bd60..b1e5ba73 100644 --- a/lttng-filter-interpreter.c +++ b/lttng-filter-interpreter.c @@ -990,6 +990,11 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, { int64_t res; + /* Catch undefined behavior. */ + if (unlikely(estack_ax_v < 0 || estack_ax_v >= 64)) { + ret = -EINVAL; + goto end; + } res = (estack_bx_v >> estack_ax_v); estack_pop(stack, top, ax, bx); estack_ax_v = res; @@ -1000,6 +1005,11 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, { int64_t res; + /* Catch undefined behavior. */ + if (unlikely(estack_ax_v < 0 || estack_ax_v >= 64)) { + ret = -EINVAL; + goto end; + } res = (estack_bx_v << estack_ax_v); estack_pop(stack, top, ax, bx); estack_ax_v = res;