3 ms·
> You can even get double free in Rust if you take the time to build an entire machine emulator and then run something that uses Malloc in the ensuing VM. No,
by School-Cotton 1y ago
> You can even get double free in Rust if you take the time to build an entire machine emulator and then run something that uses Malloc in the ensuing VM.
No, this wouldn't be a double free in Rust, it'd be a double free in whatever language you used to write the emulated code.
The distinction is meaningful, because the logic error he's talking about is possible in actual rust (even without unsafe), not just theoretically in some virtual system that you can use Rust to write a simulation for.
- charcircuit 1y agoAnother example would be making your own allocator in Rust.
- School-Cotton 1y agoNot possible without unsafe.
- bfndkgkskk 1y agoEverything is possible in a turing complete language.
- Dylan16807 1y agoEvery calculation is possible. That's a lot less than everything. If you write a virtual machine in a memory safe language you can simulate a double free inside the VM, but the VM won't have the same memory contents and connections to the outside world as the real machine. You won't get the same outcome.
- charcircuit 1y agoSure it is. Have an array which you allocate from.