quininer / ritsu

An experimental asynchronous runtime based on `io-uring`.
MIT License
76 stars 4 forks source link

Use-after-free bug #9

Closed zbchern closed 4 years ago

zbchern commented 4 years ago

Hi, I would like to confirm whether there is a use-after-free bug in the following code (ritsu/src/util.rs). Specifically, when this function returns, the buffer bufs becomes invalid. Do we need to add std::mem::forget(bufs) to prevent it? Thanks!

https://github.com/quininer/ritsu/blob/2131677458f146f86307c85bc820256fca40e61e/src/util.rs#L34-L45

quininer commented 4 years ago

bufs is valid, you need to check into_raw_parts.