Hacker News new | ask | show | jobs
by tialaramex 61 days ago
> Anytime you already have the C or C++ code but not the WUFFS.

But we literally do already have WebP for WUFFS.

> Like what?

Take a recent (September) double-free in the C codec, it's easy to write that in C. We have a Thing, we sometimes make an alias to the Thing, and then later we free both the alias and the original Thing. In Rust when you try to write this the compiler is unhappy. We can either have the same realisation which led to that being fixed (we do not need this alias, it should not be created) -- which I'd say is likely for a competent Rust programmer or we can clone the Thing, and then free both the clone and original, which is not a bug unlike the C library but is a waste of performance.

1 comments

> But we literally do already have WebP for WUFFS.

This comes down to how strong your claim is, and what point you're trying to make.

If you're saying that compiling codecs in Fil-C is not a good use of Fil-C in general, then that's wrong, because not all codecs have a WUFFS version.

If you're saying that compiling WebP with Fil-C is not a good use of Fil-C because there's a WUFFS version, then that's also wrong, because I can't use the WUFFS version in a fully memory-safe web browser, since WUFFS doesn't support Fil-ABI and nobody has written a browser where the whole transitive closure of everything that the browser uses is WUFFS or some other safe language.

On the other hand, that is possible with Fil-C. (I'm posting this comment using a memory safe browser built with Fil-C, which has WebP built with Fil-C as well as everything else down to the libc/libc++ layer built with Fil-C.)

> double-free

Double-frees are deterministic panics in Fil-C. So yeah, Fil-C catches that, and any other memroy safety violation that could be used to achieve weird execution

> Double-frees are deterministic panics in Fil-C

What does "deterministic panic" mean here? It sounds like that's a runtime panic, but the whole point of the paragraph you were quoting is compile time safety.

WUFFS is able to guarantee safety of the codec at compile time.

Rust is able to offer only some of its guarantees at compile time, and the rest are delivered at runtime.

Fil-C delivers almost all of its safety guarantees at runtime.

Yes, Fil-C delivers almost all of its safety guarantees at runtime, because from a security standpoint, that's good enough.