Type++: Prohibiting Type Confusion with Inline Type Information [pdf]
ndss-symposium.org
ndss-symposium.org
Type++ analyzes all application code and infers which classes are ever cast. All of those classes are adapted to include type information (in the form of an RTTI field). All casts are then changed into explicit casts.
As a dialect, some light changes are necessary and we evaluate the amount of code changes --- which are usually small. This gives us type safety for even large programs as evaluated.
A short blog is available here: https://nebelwelt.net/blog/2025/0226-typepp.html
I am not a Java expert but I know enough Rust to detect a problem here. Maybe it just needs clarification?
Rust is often not in fact storing the "inline type field", so presumably they're thinking of some very particular cast and not "all casts". But what cast?
some_f64 as i32 // Nope, that's going to emit code to work out the closest integer
<&str>::try_from(filename).unwrap() // Nope, that's just going to check the filename is UTF-8 encoded
OK, they talk about "down casts" Rust doesn't have inheritance, but presumably they're thinking of e.g how you go from an IpAddr to an Ipv4Addr ? And now at last it makes a little sense, yes we do need to store the difference between v4 and v6 in the data structure. But, what I do not understand is, how can the equivalent C++ (without type++) do anything reasonable here? Why would this be a bug people repeatedly trip? I know C++ is famously the language for footguns, but this is some gets() level stuff if the "no type info YOLO cast" is a thing people actually write.Also their story about finding allocation sites using static analysis is wishful thinking. There's just too much code out there that does super funky stuff at allocation sites.
And they forgot to cite Fil-C (and Fil-C++), which does achieve full memory safety (and has a complete story for what happens in downcasts). They also forgot to cite a lot of their other competition.
Bad casts account for a minority of memory safety issues. It’ll cost nothing for attackers to look elsewhere. So adopting this will more non zero work for zero gain.