FAILURE MAP
← Case archive

FA-4076 / Binary formats / Open access

COBS decoding inserts a zero after the final block · case 01

COBS decoding inserts a zero after the final block.

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

ROOT CAUSE

The implementation applies an operation whose text or grammar semantics violate this contract: Decode COBS code blocks to bytes; insert an implied zero only between blocks with code below 255. Reject zero code or truncation.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Decode COBS code blocks to bytes; insert an implied zero only between blocks with code below 255. Reject zero code or truncation.

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

Case contract

Decode COBS code blocks to bytes; insert an implied zero only between blocks with code below 255. Reject zero code or truncation.

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

SHA-256 / c638045dd92795dda29989256ca95daf797d71bb6dbb89a14aa23ef22a8de7dd

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:
        out=[]
        i=0
        while i<len(x):
            c=x[i]
            if not c or i+c>len(x): return None
            out.extend(x[i+1:i+c])
            if c<255: out.append(0)
            i+=c
        return out
    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, 2, 66]), [65, 0, 66])
check('boundary 2', solve([1]), [])
check('boundary 3', solve([2, 65]), [65])
check('boundary 4', solve([0]), None)
check('boundary 5', solve([3, 65]), None)
check('boundary 6', solve([2, 0]), 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
boundary 1[65, 0, 66, 0][65, 0, 66]Failed
boundary 2[0][]Failed
boundary 3[65, 0][65]Failed
boundary 4NoneNonePassed
boundary 5NoneNonePassed
boundary 6[0, 0]NoneFailed

SHA-256 / 41e4eb6a6087648e41db4653e4210b8e6581847492d33337bc5c68f778e14970

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:
        out=[]
        i=0
        while i<len(x):
            c=x[i]
            if not c or i+c>len(x): return None
            if 0 in x[i+1:i+c]: return None
            out.extend(x[i+1:i+c])
            i+=c
            if c<255 and i<len(x): out.append(0)
        return out
    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, 2, 66]), [65, 0, 66])
check('boundary 2', solve([1]), [])
check('boundary 3', solve([2, 65]), [65])
check('boundary 4', solve([0]), None)
check('boundary 5', solve([3, 65]), None)
check('boundary 6', solve([2, 0]), 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
boundary 1[65, 0, 66][65, 0, 66]Passed
boundary 2[][]Passed
boundary 3[65][65]Passed
boundary 4NoneNonePassed
boundary 5NoneNonePassed
boundary 6NoneNonePassed

SHA-256 / fd575892b80354db671ba77b185be79bfbd14fe1997648792be4bfd24b9d9853

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

Case digest / 6b2b7377479f632c51b9c4a7d576fbc3694136921db8f0c3a1fe19959a67b97a