by staticassertion · 7y ago · 0 comments
https://hackernoon.com/python-sandbox-escape-via-a-memory-co...
I'd say more people have had to jump into "unsafe" Python than have had to jump into "unsafe" Rust.
As for overflow checking, that won't lead to unsafety on its own, just panics (it's defined to wrap in release).
Your post conflates all sorts of issues and lacks nuance.
A wrap around on its own can not cause unsafety in rust, only panics.
As in, maybe you try to use the wrapped integer as an array index, that's still safe even if it wraps (because Rust bounds checks).
It would only case memory safety when used alongside code in an unsafe block.
> The author says that it is very hard not easy to exploit C libraries loaded by Python.
I drew a different conclusion from that section
You are either misinformed or do not know what safety means. Integer types in Rust in release mode wraps around and that can lead to consequences much worse than crashing. Programs doing the exact opposite of what they were intended to.
Now I see that you are talking about MEMORY safety which I'm not. Writing safe programs includes so much more than just memory safety.
> I drew a different conclusion from that section
I have not seen a single CVE about the issue.
Yes, what rust claims is memory safety, not safety from all forms of bugs. If you don't want wrapping integers, you can compile with a flag to panic on overflow, or use types in std that will have the behavior you want.
> I have not seen a single CVE about the issue.
That's part of the point of the article. CVEs are rarely filed for memory safety issues in the underlying C libraries that make up the Python ecosystem.