FAILURE MAP
← Case archive

FA-11596 / Compression format semantics / Open access

LZ history keeps references beyond its window · case 01

LZ history keeps references beyond its window.

Verified by executionVariant 1 · 6 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The decoder checks against all past output rather than the retained window.

VERIFIED REPAIR

Check distance inclusively against both available history and the configured window before dereferencing.

Unsuccessful approach: A strict less-than boundary rejects the oldest still-valid byte.

Case contract

Return the byte distance behind output only if 1 <= distance <= min(width,len(history)); otherwise return None. Width is positive.

Why this case matters

A small offline codec model isolates a compression-specific failure without external files or libraries.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(history, width, distance):
    return history[-distance] if 1 <= distance <= len(history) else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expired',solve('a'*(N+3),N,N+1),None)
check('oldest valid',solve('abcdef',3,3),'d')
check('nearest',solve('abc',2,1),'c')
check('before stream',solve('a',5,2),None)
check('zero',solve('abc',2,0),None)
check('empty history',solve('',4,1),None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
expiredaNoneFailed
oldest validddPassed
nearestccPassed
before streamNoneNonePassed
zeroNoneNonePassed
empty historyNoneNonePassed

SHA-256 / 6d505a172a4c31ab6a852d2824f9ca4377c342ceb8a9da43510bbcd7dad36de1

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(history, width, distance):
    return history[-distance] if 1 <= distance < min(width,len(history)) else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expired',solve('a'*(N+3),N,N+1),None)
check('oldest valid',solve('abcdef',3,3),'d')
check('nearest',solve('abc',2,1),'c')
check('before stream',solve('a',5,2),None)
check('zero',solve('abc',2,0),None)
check('empty history',solve('',4,1),None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
expiredNoneNonePassed
oldest validNonedFailed
nearestccPassed
before streamNoneNonePassed
zeroNoneNonePassed
empty historyNoneNonePassed

SHA-256 / 26d59651df9951d7376dd282720285f9d5c577a6997dd24c6f420b82ce8aeec9

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(history, width, distance):
    return history[-distance] if 1 <= distance <= min(width,len(history)) else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('expired',solve('a'*(N+3),N,N+1),None)
check('oldest valid',solve('abcdef',3,3),'d')
check('nearest',solve('abc',2,1),'c')
check('before stream',solve('a',5,2),None)
check('zero',solve('abc',2,0),None)
check('empty history',solve('',4,1),None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
expiredNoneNonePassed
oldest validddPassed
nearestccPassed
before streamNoneNonePassed
zeroNoneNonePassed
empty historyNoneNonePassed

SHA-256 / aa5596f5a2421fdd599c3688f57469ba0bf2ef887c2cdd3759c5d1d532eaaef4

Verification & scope

Controlled educational model, not a complete implementation of a production compression format. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:38:49.290517+00:00.

Case digest / f774f7c36ff48c6588c80c24f3e338d77c11f71a7ed1077d77a317dfddb657f8