FAILURE MAP
← Case archive

FA-3671 / Binary formats / Open access

Fixed text padding removal destroys embedded zero bytes · case 01

Fixed text padding removal destroys embedded zero bytes.

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: Strip only trailing zero bytes from a fixed-width binary field.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Strip only trailing zero bytes from a fixed-width binary field.

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

Case contract

Strip only trailing zero bytes from a fixed-width binary field.

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

SHA-256 / 271fda879ef7e2a96a63b28907b01938e2f99ad116648014df03cd6a2d54dd87

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

SHA-256 / 05da5a86a8478b62458c3999e5f57ee7cc02edfd25300fa1943f2a5453eb8c59

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 list(bytes(x).rstrip(b'\x00'))
    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([65, 0, 66, 0]), [65, 0, 66])
check('boundary 2', solve([0, 0]), [])
check('boundary 3', solve([0, 65]), [0, 65])
check('boundary 4', solve([65]), [65])
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, 0, 66][65, 0, 66]Passed
boundary 2[][]Passed
boundary 3[0, 65][0, 65]Passed
boundary 4[65][65]Passed

SHA-256 / 0d302c5621db8d068fe43756d0720b7fa2c10122e5414ef980abd047e179d320

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

Case digest / 5482d79440e29573cf16628558df4d9f881da2d449d23b88f3a9ddefe3b2fc62