FAILURE MAP
← Case archive

FA-3676 / Binary formats / Open access

A Pascal string length exceeds its physical slot · case 01

A Pascal string length exceeds its physical slot.

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 length-prefixed bytes, clamping declared length to available slot capacity.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Decode length-prefixed bytes, clamping declared length to available slot capacity.

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

Case contract

Decode length-prefixed bytes, clamping declared length to available slot capacity.

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, 66, 0]), [65, 66])
check('boundary 2', solve([5, 65, 66]), [65, 66])
check('boundary 3', solve([0, 65]), [])
check('boundary 4', solve([]), [])
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, 66, 0][65, 66]Failed
boundary 2[65, 66][65, 66]Passed
boundary 3[65][]Failed
boundary 4[][]Passed

SHA-256 / f92fcd919d5d6aa424e9799e2bbf65905c4e44fdd301f82bcc632f7104df03bf

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:x[0]] if x else []
    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, 66, 0]), [65, 66])
check('boundary 2', solve([5, 65, 66]), [65, 66])
check('boundary 3', solve([0, 65]), [])
check('boundary 4', solve([]), [])
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][65, 66]Failed
boundary 2[65, 66][65, 66]Passed
boundary 3[][]Passed
boundary 4[][]Passed

SHA-256 / 6d9853f637ed5abccb8103e775020b1ba90895452797c339cb538ca0f7fa4400

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:1+min(x[0],len(x)-1)] if x else []
    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, 66, 0]), [65, 66])
check('boundary 2', solve([5, 65, 66]), [65, 66])
check('boundary 3', solve([0, 65]), [])
check('boundary 4', solve([]), [])
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, 66][65, 66]Passed
boundary 2[65, 66][65, 66]Passed
boundary 3[][]Passed
boundary 4[][]Passed

SHA-256 / 2af25cd4dac5d13f67890216847a5bd7c6d54269c8568e16b2f7a1d08e7f6126

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

Case digest / 28499c372c01214f51e0aebfa3c4661e8529be2bda2961053e0c0b5ca84dd101