sangkeon / java-opa-wasm

Apache License 2.0
15 stars 2 forks source link

io.github.kawamuray.wasmtime.TrapException: wasm trap: out of bounds memory access wasm backtrace #6

Closed rai-prashanna closed 1 year ago

rai-prashanna commented 1 year ago

io.github.kawamuray.wasmtime.TrapException: wasm trap: undefined element: out of bounds table access wasm backtrace: 0: 0x22804 - !re2::DFA::Search(re2::StringPiece const&, re2::StringPiece const&, bool, bool, bool, bool*, char const*, re2::SparseSetT) 1: 0x22b87 - !re2::Prog::SearchDFA(re2::StringPiece const&, re2::StringPiece const&, re2::Prog::Anchor, re2::Prog::MatchKind, re2::StringPiece, bool, re2::SparseSetT) 2: 0x33b3a - !re2::RE2::Match(re2::StringPiece const&, unsigned long, unsigned long, re2::RE2::Anchor, re2::StringPiece, int) const 3: 0x33807 - !re2::RE2::DoMatch(re2::StringPiece const&, re2::RE2::Anchor, unsigned long, re2::RE2::Arg const const, int) const 4: 0x33d44 - !re2::RE2::PartialMatchN(re2::StringPiece const&, re2::RE2 const&, re2::RE2::Arg const const*, int) 5: 0xbd51 - !opa_regex_match 6: 0x3aef0 - !g0.data.authz.redfish.v1.policy.allow 7: 0x816 - !eval 8: 0x7a1 - !opa_eval note: run with WASMTIME_BACKTRACE_DETAILS=1 environment variable to display more information

rai-prashanna commented 1 year ago

Steps to replicate this exception are : 1> my rego file and data are in this link https://play.openpolicyagent.org/p/pPTKVn2oke 2> i optimize rego file using this command /programs/opa_linux_amd64-0.52.0 build -O=1 . 3> I extracted optimized rego from bundle. 4> Again, I created wasm binary from optimized rego file using this command /home/epraria/programs/opa_linux_amd64-0.52.0 build -t wasm policy.rego e 'authz/policy/allow' 5> when i try to evaluate input agains this wasm binary using java-opa-wasm library. I get this exception

sangkeon commented 1 year ago

I'll check it out this weekend.

sangkeon commented 1 year ago

Resolved in 0.2.2