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

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 -> catastrophic

The 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 edit the files, run the visible tests and submit against the hidden ones. More Java bug hunts.