3 ms·
> But parsing and memory safety are hard. Like, really hard. This doesn't have to be the case. Start by avoiding C and C++. Use Java (on Android) to write pars
by ekidd 5y ago
> But parsing and memory safety are hard. Like, really hard.
This doesn't have to be the case. Start by avoiding C and C++. Use Java (on Android) to write parsers. It is very hard to take a buggy parser written in Java, and to escalate to a memory corruption attack.
If you really can't use a language like Java, write your parser in safe Rust using slices over Vec<u8>. Then run a fuzzer over it. You'll find a few runtime panics, but you're vanishingly unlikely to encounter memory corruption.
Buffer overflows and memory corruption can be almost entirely avoided these days, at a price.
- andrewzah 5y agoYes, I imagine that in the future we'll be writing these sorts of tools in memory-safe languages like Rust. In fact I believe that it's hubris to think that we can write massive, complex systems in unsafe languages and -not- overlook some bugs here and there. We had no choice but to use these languages before, but Rust, etc, give us alternate choices now.