FAILURE MAP
← Case archive

FA-3661 / Binary formats / Open access

A byte-count prefix is trusted without checking body size · case 01

A byte-count prefix is trusted without checking body size.

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

ROOT CAUSE

The implementation applies an operation whose text or grammar semantics violate this contract: Decode one-byte length and exact payload; return payload bytes or None.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Decode one-byte length and exact payload; return payload bytes or None.

Unsuccessful approach: The attempted repair handles the primary example but still violates a separate boundary of the same contract.

Case contract

Decode one-byte length and exact payload; return payload bytes or None.

Why this case matters

A local executable model for consumers of structured text; oracle values are authored literals, not outputs copied from the repaired implementation.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return x[1:]
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve([2, 65]), None)
check('boundary 2', solve([1, 65, 66]), None)
check('boundary 3', solve([2, 65, 66]), [65, 66])
check('boundary 4', solve([0]), [])
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
boundary 1[65]NoneFailed
boundary 2[65, 66]NoneFailed
boundary 3[65, 66][65, 66]Passed
boundary 4[][]Passed

SHA-256 / 60d658fdacc94d2ff078bb6b14d1012e0017717f777c437e14f0cf729d025e86

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return x[1:1+x[0]] if x else None
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve([2, 65]), None)
check('boundary 2', solve([1, 65, 66]), None)
check('boundary 3', solve([2, 65, 66]), [65, 66])
check('boundary 4', solve([0]), [])
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
boundary 1[65]NoneFailed
boundary 2[65]NoneFailed
boundary 3[65, 66][65, 66]Passed
boundary 4[][]Passed

SHA-256 / f663d2fad6143fa95f13963491247b61cdd9a7afdf28cf6739102193e3705c2a

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return x[1:] if x and len(x)==x[0]+1 else None
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('boundary 1', solve([2, 65]), None)
check('boundary 2', solve([1, 65, 66]), None)
check('boundary 3', solve([2, 65, 66]), [65, 66])
check('boundary 4', solve([0]), [])
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
boundary 1NoneNonePassed
boundary 2NoneNonePassed
boundary 3[65, 66][65, 66]Passed
boundary 4[][]Passed

SHA-256 / 7f8bd3999a8ac538ffb72b6d539abc16077a5cf4db4fb3b872f5b45c920bbdd3

Verification & scope

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:37:29.171659+00:00.

Case digest / d2218664eeb15912d6f9e0e467e3f316e124bf61c07c34004097e94757e5a207