Hacker News new | ask | show | jobs
by ngrilly 1483 days ago
> I can assure you that you cannot access undefined memory regions by doing this in Go.

Current implementation of slices and interfaces in Go is not memory safe in presence of data races:

https://blog.stalkr.net/2022/01/universal-go-exploit-using-d...

2 comments

This is the kind of edge case you can find in lots of languages, including Rust (which has plenty of past and present soundness bugs).
Data races are violations of the memory model; of course any code which produces data races cannot be understood as memory safe?
As far as I remember, some languages like Java are memory safe even if the code produces data races. That means you can't have a reference to a value supposed to be of type A being actually of type B.
That's part of what the Rust borrow checker does for you: tracking who owns what and enforcing single ownership makes data races that much harder to cause.