Some day, businesses creating software plagued with bugs may be able to fix it automatically by stitching it up with clean, unbroken code.
Researchers at the Massachusetts Institute of Technology showed off an automated code-repair system at a computing conference earlier this month that works similar to the way a surgeon applies a skin graft to damaged tissue. The new system detects bugs, takes healthy code from a publicly available source, and then grafts it onto the sick software.
Presto, problem solved.
The system taps into the growing number of public software libraries like GitHub and BitBucket that anyone can draw upon for free to help with their own software projects. The MIT team's system takes advantage of the reality that many projects — although different — often share similar code. Part of one project can be fused onto another, at least in theory, to fix a bug. The trick is to get a computer to recognize the problematic code and then fuse the healthy code onto it.
The MIT team tested the system, called CodePhage, on seven open-source programs that they found bugs in. Each software repair took between two to ten minutes.
Fixing buggy code is becoming increasingly important as more companies like car manufacturers and airliners create software. It could also be a way for companies to save huge amounts of money on programmers by having computers do the grunt work of finding and fixing bugs.
In early June, an Airbus military plane crashed and killed four people reportedly because of badly installed engine control software. Although the software itself didn’t contain any known bugs, once it was installed it created unforeseen conflicts with other software that led to the aircraft’s engines stalling. The lesson to take away is that while software may not appear to be buggy, once you combine it with other software and systems in a live environment, there could be unforeseen glitches.
The MIT team isn't the only one working to solve problems with buggy software. For example, Burlington, Mass.-based Veracode, which last year raised $40 million and is prepping for an initial public offering, sells a bug-scanning system. Developers can hook up the tools they use to build software programs to Veracode’s cloud-based service that then scans their apps for potential glitches.
Subscribe to Data Sheet, Fortune’s daily newsletter on the business of technology.
For more on cybersecurity, check out the following video from Fortune: