From fe12347f3557ca1db64b33ce9a83026143fa2e3f Mon Sep 17 00:00:00 2001 From: AntDum <64007882+AntDum@users.noreply.github.com> Date: Tue, 2 May 2023 13:32:44 +0200 Subject: [PATCH] example for select --- examples/taint/simple/select_taint.wat | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 examples/taint/simple/select_taint.wat diff --git a/examples/taint/simple/select_taint.wat b/examples/taint/simple/select_taint.wat new file mode 100644 index 00000000..942f642e --- /dev/null +++ b/examples/taint/simple/select_taint.wat @@ -0,0 +1,28 @@ +(module + (import "imports" "output" (func $print (;0;) (param i32))) + + (func $source (param i32)) + (export "taint_source" (func $source)) + (func $sink (param i32)) + (export "taint_sink" (func $sink)) + + (func $f (local $locA i32) + i32.const 10 + local.set $locA + + ;; mark locA as tainted + local.get $locA + call $source + + local.get $locA ;; select if true + i32.const 20 ;; select if false + + i32.const 1 ;; true + select + + ;; pass value to sink + call $sink + ) + + (start $f) +)