MISRA C might be provably safe.
MISRA C might be provably safe.
Posted Nov 19, 2025 12:57 UTC (Wed) by gmatht (guest, #58961)In reply to: Memory-safe C code by tialaramex
Parent article: Rust in Android: move fast and fix things (Google Security Blog)
Much of the difficulty of proving the safety of C is use-after free and double-frees. MISRA-C solves this by completely banning the use of dynamically allocated memory (even in memory-safe languages; you don't want your brakes to fail when malloc does). In MISRA-C:2012 there is also the advisory rule 17.5 which requires that array parameters to functions should have bounds specified.
For all I know MISRA-C is provably safe. I have seen many claims that MISRA is safe, but the context implies that they mean safe in an informal English sense of the word.
I wouldn't want to write a word processor in MISRA-C, but I understand there is a lot of safety-critical code written in MISRA-C. If there isn't a memory-safe compiler for MISRA-C there should be.
The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:
Note: you can avoid this step in the future by logging into your LWN account.
