dotnet-opa-wasm
dotnet-opa-wasm copied to clipboard
Fix memory overflow if WriteString exceed memory capacity
- The memory allocated for the initial GetData wasn't reused if different data was loaded.
-
FastEvaluate()
is called when_dataHeapPtr
is near the end of the memory store, it can overflow the store. I created a method to check the memory capacity and grow as necessary.
https://github.com/open-policy-agent/npm-opa-wasm/blob/3e618c84a07ba3af8d7bab75eb77395bd79d7c54/src/opa.js#L267
this library mimics what npm-opa-wasm does in terms of execution order.
https://github.com/open-policy-agent/npm-opa-wasm/blob/3e618c84a07ba3af8d7bab75eb77395bd79d7c54/src/opa.js#L267
this library mimics what npm-opa-wasm does in terms of execution order.
I can take out the first commit, if that helps. It's a small amount of wasted memory. The second commit is the important one.
Yes (and I just saw that npm-opa-wasm has applied memory fixes recently, so I'll have to take a look at their recent history too)
Edit: opened #38 for mem fix note above.
Can we somehow unit test the behavior?
Can we somehow unit test the behavior?
I think so. Give a me a couple days.
https://github.com/open-policy-agent/npm-opa-wasm/commit/f1be838de45e3310e7c37bcebbfa387ac17c4db3 corresponding JS impl