liveBook · Manning

Integer overflow

As explained in Grokking Software Architecture

Integer overflow is the condition in which an integer computation or conversion produces a value outside the representable range of the target integer type.

Integer overflow occurs when a value exceeds the range a target integer type can represent. A conversion can trigger it even when the original value is stored in a larger type. section 10.7.1

Ariane 5 navigation failure

The navigation system stored horizontal velocity as a 64-bit floating-point value, then converted it to a 16-bit signed integer, whose maximum is 32,767. The faster Ariane 5 exceeded that limit; the conversion caused an unhandled exception and crashed the navigation computer. section 10.7.1

The overflow was the trigger; the surrounding decisions made it catastrophic:

  • Code designed to align navigation computers on the launchpad kept running for 50 seconds after liftoff, even though it was no longer needed. section 10.7.2
  • Engineers reused code that had been safe on Ariane 4 without rigorously testing it against Ariane 5’s faster flight profile. Simulating the new rocket’s expected speeds could have exposed the limit safely. section 10.7.2
Figure 10.9 The Ariane 5 Bug: An architectural failure of physical context. A massive 64-bit vector of physical force fundamentally cannot fit into a 16-bit memory space.

Illustrates the mismatch between the velocity value and the smaller integer type. section 10.7.1

How Grokking Software Architecture covers it

How deep it goes
Explains a type conversion failure, its runtime effect, and the context and testing decisions behind it.
Examples
Uses Ariane 5 velocity conversion and Ariane 4 alignment-code reuse as examples.
What you can do after
Diagnose range-related failures by checking target-type limits and testing reused code against its new operating context.
How it connects
Connects integer overflow to numeric type limits, legacy-code reuse, simulation, and resilience.

Also explained in

Compare how 2 books explain integer overflow →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.