Ariane's Sixteen Bits — Java Bug Hunt
Inspired by Ariane 5's maiden flight in 1996: a 64-bit velocity value crammed into a 16-bit register overflowed 37 seconds after launch, the guidance…
- Language: Java
- Layer: Backend
- Difficulty: Hard
- Concepts: Overflow, Casting
- Modelled on: Ariane 5 · 1996
- Visible tests: in-range values pass through; positive overflow saturates instead of wrapping; negative overflow saturates too
- Reward: 50 XP for a complete fix
Incident
- Severity: SEV-1 (priority: Existential)
- Ticket: BUG-501
- Reported by: guidance
- Time to fix: 35 minutes, the target for a hard incident
Failing checks on the shipped build
- positive overflow saturates instead of wrapping — must clamp, not wrap: expected 32767 but got -25536
- negative overflow saturates too — expected -32768 but got 15536
How to work this incident
- Read the report: write down the expected behaviour and the actual one in a sentence each.
- Reproduce it: run the visible tests and find the failing check that matches the report.
- Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
- Follow the request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
- Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.
Briefing
Inspired by Ariane 5's maiden flight in 1996: a 64-bit velocity value crammed into a 16-bit register overflowed 37 seconds after launch, the guidance computer shut down, and a $370M rocket self-destructed.
Telemetry.java packs sensor readings into 16-bit fields. The spec says saturate — the code says cast and pray.
Bug report
BUG-501 · Priority: Existential · Reported by: guidance
pack16(value) rules:
- values inside [-32768, 32767] pass through exactly
- values beyond either bound SATURATE to that bound (never wrap!)
Observed: pack16(40000) returns -25536 — the vehicle thinks it reversed direction at Mach 3.
Logs
[guidance] BH=40000 packed=-25536
[guidance] attitude correction -> catastrophicThe code as shipped
Telemetry.java (editable)
class Telemetry {
// Packs a horizontal-bias reading into a 16-bit field.
static int pack16(int value) {
return (short) value;
}
}Open the hunt to start the incident clock, edit the files, run the visible tests and submit against the hidden ones, then write the root cause down. More Java bug hunts.