Urgent.News

What's breaking now, across thousands of outlets.

AI

Google Rewrites Critical C Dependencies to Rust Using AI and Differential Fuzzing

Google's security team developed a method to replace legacy C code in the giflib image-processing library with Rust, targeting inherent memory vulnerabilities. They utilised an automated migration process, ensuring compatibility and zero-day vulnerability mitigation. The project successfully maintained runtime performance while demonstrating that AI translations require ongoing human oversight.…

Google engineers have successfully migrated a critical C library, giflib, to Rust using artificial intelligence and a technique called differential fuzzing. The team focused on the 3,000-line image-processing library, which often decodes untrusted user input without proper safeguards. By converting the library into a memory-safe Rust equivalent, Google was able to eliminate a previously unpatched heap write vulnerability without the need for legacy sandboxes.

The migration process involved three stages: translating the entire logic of the C library into Rust using a single prompt with Google's Gemini AI, retaining the original exported symbols and struct definitions to maintain ABI compatibility, and refining pointer ownership and lifetime invariants using human experts. The team then employed automated differential testing engines to detect any behavioural discrepancies between the Rust and C implementations, feeding the failure traces back to the model for iterative patch synthesis.

To prevent undefined behaviour when passing pointers across the C boundary, the team created a foreign function interface (FFI) wrapper that reconstructed safe Rust handles from raw pointers. Extensive validation of the Rust library involved running it against over 30 million real-world GIF assets, ensuring bit-for-bit rendering parity with the original C implementation.

Differential fuzzing ran continuously for six days, executing 200 million iterations without observing any functional drift. During staging, an external security researcher discovered an out-of-bounds heap write in the upstream giflib, which was catalogued as CVE-2026-26740. Google's Rust implementation proved structurally immune to this flaw before public disclosure, demonstrating that architectural language migrations can preempt entire vulnerability classes.

Despite the efficiency gains, the authors cautioned that AI-assisted porting is not a hands-off solution. Forking upstream C dependencies into Rust repositories creates sustained maintenance divergence, and FFI wrappers still require human expertise to prevent lifetime leaks and maintain thread-safety invariants. While some praised Google's rigorous differential fuzzing framework and debated the practicality of the one-shot translation approach, others argued that deterministic transpilers followed by AI-driven refactoring might be more reliable for larger libraries.

Written by urgent.news from InfoQ's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at infoq.com →

More in AI

More from Sunday 27 September →