Skip to main content

BorderlineData

Integer Overflow

BLOG

$370 million Integer Overflow:

Ariane 5 Disaster

Let’s talk about the most expensive software bug in history. It didn’t happen in a web app or a trendy crypto startup. It happened inside a rocket built by the European Space Agency in 1996 called the Ariane 5.

Cost of the rocket? $370 million.

Time it took to explode after launch? 37 seconds.

The cause? A missing boundary check on an integer.

 

The Legacy Code Trap

 

The engineers working on the Ariane 5 decided to reuse software modules from its predecessor, the Ariane 4. It makes sense on paper—reusable code is efficient, right?

Well, the Ariane 4 was a slower rocket. The software used a 16-bit signed integer to store a variable tracking “horizontal velocity.” For the non-binary-nerds out there, a 16-bit signed integer has a strict mathematical boundary: it can only hold numbers up to 32,767.

 

Crossing the Line

 

Because the Ariane 5 was a much faster, more powerful beast, its acceleration numbers were significantly higher. Exactly 36.7 seconds into the flight, the rocket’s velocity hit a number higher than 32,767.

The software tried to cram this massive value into the tiny 16-bit box. The system suffered an integer overflow, panicked, and spit out an unhandled exception error code.

The guidance computer read that error code not as a software crash, but as an actual, insane shift in trajectory. It tried to correct the rocket’s path by flexing the nozzle engines to their absolute limits. The aerodynamic stress tore the booster rockets off, and the onboard computer self-destructed the vehicle to prevent it from crashing into a city.

[ Real Velocity: 32,768 ] ---> [ 16-Bit Integer Box (Max 32,767) ] = OVERFLOW / CRASH

 

The Lesson

 

Never assume that because code worked in Environment A, it will work in Environment B without checking the boundaries. If the QA team had run a simple negative test using simulated out-of-bounds velocity data, the bug would have popped up instantly on a monitor, rather than lighting up the sky over French Guiana.