logoalt Hacker News

NobodyNada • today at 2:07 PM • 1 reply • view on HN

If you wrote a Q_free function and called it after `free(l);` to actually demonstrate the UAF, that would be pretty close to the semantics of the Rust example.


Replies

1718627440 • today at 2:26 PM

I have added that now.

I originally didn't do this, because I didn't feel the need to invoke UB without necessity. Also I wanted to demonstrate, that the error can (and is) caught in C, without actually committing the double-free (so that the program behaviour is still well-defined, but the abstraction is already violated).

➕ show 1 reply