How Rust helps Android get safer without a total rewrite
Safer new components can prevent familiar software mistakes while working alongside older code, but Android’s image-processing near-miss shows why other defenses still matter.
Your phone can gain protection against a common source of crashes and security holes one new component at a time. Android’s transition to the programming language Rust shows how: prevent certain mistakes in new software while continuing to maintain the older parts people already depend on.
In its November 13, 2025 assessment, Google reported that memory-safety flaws had fallen below 20% of Android’s total vulnerabilities for the first time. That was a dated assessment published before year-end, not a fresh measurement of today’s phones. But the strategy behind it remains useful to understand: a large operating system can improve without a wholesale replacement.
Consider what happens when a phone opens a picture. Software must interpret the file’s contents and work with areas of memory holding image data. Imagine, as a simplified example, a piece of that software asking for a fifth value from a list containing only four. Another possible mistake is continuing to use image data after the memory holding it has been released for reuse.
These are memory-safety problems: software reaching outside the memory it may legitimately use. They can cause crashes or create security vulnerabilities. Rust puts checks around both the lifetime of data and access to it, although those checks happen at different stages.
Rust’s ownership rules track responsibility for data and restrict how it can be used. Its compiler—the tool that turns source code into a runnable program—rejects code that violates those rules. A mistake involving an expired reference can therefore be caught before the software reaches a phone. Rust’s official book explains this system; Android’s documentation distinguishes these advance checks from checks performed while software runs.
The fifth-value problem illustrates the latter. With Rust’s standard growable list, a checked lookup can report that no such value exists. Ordinary indexing beyond the list instead triggers a “panic,” an explicit failure that interrupts execution. Neither provides the requested value by wandering into neighboring memory. This is documented language behavior, not a promise that every malformed image will be detected before a program runs—or that memory-safe software cannot crash.
The next question is how to introduce those protections into something as sprawling as Android.
Google’s 2024 explanation of its approach emphasizes new development. Its analysis found memory-safety vulnerabilities concentrated in recent changes, while older code had generally undergone more bug fixing. Age alone does not certify software as safe. The practical implication is that replacing every established component can be a less useful investment than preventing fresh mistakes and repairing known defects.
New Rust components can call existing C and C++ software through defined interfaces, allowing them to reuse functionality already built. Google described this groundwork in its 2021 account of connecting the languages. Those connections make gradual adoption possible. They also require care: the Rust Reference warns that serious memory errors in C can affect Rust within the same program, and vice versa. A language boundary is not automatic isolation.
Google’s reported improvements also need their labels kept attached. Its November 2025 estimate used roughly five million lines of Rust and one potential memory-safety vulnerability, fixed before release, to arrive at 0.2 vulnerabilities per million lines. It compared that with a historical C/C++ density near 1,000 per million lines. One flaw is a count; flaws per million lines measure density; the below-20% figure describes a share of all vulnerabilities. None measures a phone owner’s probability of being attacked. These are Google’s observations of evolving software, not a controlled experiment isolating language choice.
That single Rust flaw makes the limitations unusually concrete. Google says a buffer overflow in CrabbyAVIF involved unsafe Rust, which permits certain operations whose safety developers must establish themselves. The keyword does not disable all Rust checks, but it does place additional responsibility on programmers.
According to Google’s account, Android’s Scudo memory allocator provided protected regions that made this particular overflow non-exploitable and helped reveal it through a crash. The flaw was fixed before public release. Its identifier, CVE-2025-48530, nevertheless appears as critical in the August 2025 Android security bulletin. That listing alone does not establish that it reached users or was exploited.
For phone owners, Rust’s adoption offers prevention inside new components while older software, language interfaces and exceptional operations still need attention. Security updates remain part of that work. The image-processing near-miss shows the layers doing different jobs: language rules reduce opportunities for mistakes, another defense limits a mistake’s consequences, and engineers still have to find and fix the fault.
A missing item has two safe outcomes
Imagine a Rust Vec containing four items: A, B, C and D. A request for the fifth item is outside its length. Checked lookup with get returns None, allowing the program to handle the missing item. Ordinary indexing instead panics, interrupting execution. These are runtime protections: they do not mean every invalid request is rejected before compilation finishes. Ownership and lifetime rules provide a different protection before execution. This is a conceptual illustration, not a memory layout, an Android test or a guarantee about unsafe operations.
Sources
- Rust in Android: move fast and fix things
- What Is Ownership? — The Rust Programming Language
- Android Rust introduction
- Vec — Rust standard library documentation
- Eliminating Memory Safety Vulnerabilities at the Source
- Rust/C++ interop in the Android Platform
- Behavior considered undefined — The Rust Reference
- Unsafe Rust — The Rust Programming Language
- Android Security Bulletin—August 2025
Discussion
Kind, curious discussion is welcome. Comments are checked before appearing. Requests to direct the newsroom are discarded.