Comments (14)
Both "local.get $1" would be replaced to a slot, saying 40. So slot 40 is referenced twice. When deallocating slot 40, we need to keep a count instead of just 1 or 0. Otherwise, I would get a Assertion failed: (o->m3Slots [i_slotIndex]), function DeallocateSlot.
Also the implementation of PreserveArgsAndLocals could be made more efficient. Instead of number of locals (n) x number of references (m), we could just use O(m) time.
from wasm3.
@soundandform I think I have hit this a few times already, when working on self-hosting.
from wasm3.
Anyway I can help on this?
from wasm3.
I can fix. I had been waiting for this case to come up in an actual .wasm file.
from wasm3.
(module
(type (func))
(func (type 0)
(local i32)
local.get 0
block
i32.const 0
local.set 0
end
drop
)
(memory 1)
)
from wasm3.
Hah. Thanks. Yeah, a contrived wasm file was the runner up option :)
from wasm3.
The sample actually comes from a real wasm of a game :)
from wasm3.
It seems that we have to insert the "preserve" local operation before the previous block. What's the best way to do that?
from wasm3.
Or just preserve all locals just before a block?
from wasm3.
from wasm3.
@soundandform 4783048 doesn't seem to be right. For a "if" branch, the SetLocal could run or just not. In the latter case, replacing the local index in the stack would be wrong.
from wasm3.
@kgdev I haven't addressed loop and if yet which is why I said it was "partial."
from wasm3.
I believe this is fixed now. @kgdev please verify
from wasm3.
Should be OK now. Please report it still have problems with this
from wasm3.
Related Issues (20)
- memory leaks in Read_utf8
- Invalid Memory Read/Deref
- Program(wasm3) DoS
- Segmentation fault due to illegal write access
- Issue for running code on raspberry pico
- [Security] Out-of-Bound Memory Write on "op_CopySlot_64" Function
- [Security] Out-of-Bound Memory Read on "op_Select_f32_ssr" Function
- [Security] Out-of-Bound Memory Read on "op_Select_i64_ssr" Function
- [Security] Out-of-Bound Memory Write on "op_SetSlot_i64" Function
- [Security] Out-of-Bound Memory Read on "op_MemCopy" Function
- [Security] Out-of-Bound Memory Read on "RemoveCodePageOfCapacity" Function
- [Security] Heap Buffer Overflow on "op_SetSlot_f64" Function
- [Security] Out-of-Bound Memory Read on "op_Select_f64_rsr" Function
- [Security] Stack Overflow on "op_Entry" Function
- [Security] Out-of-Bound Memory Read on "op_Select_i64_srs" Function
- [Security] Out-of-Bound Memory Read on "op_Select_f32_rsr" Function
- [Security] Out-of-Bound Memory Read on "Environment_ReleaseCodePages" Function
- [Security] Global Buffer Overflow on "PreserveRegisterIfOccupied" Function
- [Security] Out-of-Bound Memory Read on "main" Function
- [Security] Heap Buffer Overflow on "DeallocateSlot" Function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasm3.