FAILURE MAP
← Case archive

FA-48856 / PCM sample encoding / Open access

Subbyte code packer: padding value · case 01

Tail pad bits are set, violating canonical zero padding.

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

ROOT CAUSE

Tail pad bits are set, violating canonical zero padding.

VERIFIED REPAIR

Use the stated conversion contract at padding value.

Unsuccessful approach: Repeating the final signal bit only fixes tails ending in zero.

Case contract

Pack unsigned codes fitting width 1..7 most-significant bit first after an explicit bit prefix; return octets, significant-bit count and zero tail padding count.

Why this case matters

Offline PCM interchange uses these exact bounded packet and sample representation decisions.

1 / The failure

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

N = 1
observations = []
def solve(codes, width, prefix):
    bits = list(prefix)
    for code in codes:
        bits.extend((code >> shift) & 1 for shift in range(width-1,-1,-1))
    padding = (-len(bits)) % 8
    bits += [1] * padding
    out = []
    for start in range(0,len(bits),8):
        out.append(sum(bits[start+j] << (7-j) for j in range(8)))
    return [out, len(prefix)+len(codes)*width, padding]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 7], 3, [1, 0])), [[129, 224], 11, 5])
check('oracle 2', solve(*([5, 2], 3, [])), [[168], 6, 2])
check('oracle 3', solve(*([], 3, [])), [[], 0, 0])
check('oracle 4', solve(*([15, 0], 4, [])), [[240], 8, 0])
check('oracle 5', solve(*([1], 1, [1, 1, 0])), [[208], 4, 4])
check('oracle 6', solve(*([0, 3, 2, 1], 2, [0])), [[28, 128], 9, 7])
check('oracle 7', solve(*([17, 3], 5, [1, 0, 1])), [[177, 24], 13, 3])
if N == 1: check('variant packet 1', solve(*[[0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240], 20, 4])
if N == 2: check('variant packet 2', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120], 29, 3])
if N == 3: check('variant packet 3', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60], 38, 2])
if N == 4: check('variant packet 4', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30], 47, 1])
if N == 5: check('variant packet 5', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30, 15], 56, 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
oracle 1[[129, 255], 11, 5][[129, 224], 11, 5]Failed
oracle 2[[171], 6, 2][[168], 6, 2]Failed
oracle 3[[], 0, 0][[], 0, 0]Passed
oracle 4[[240], 8, 0][[240], 8, 0]Passed
oracle 5[[223], 4, 4][[208], 4, 4]Failed
oracle 6[[28, 255], 9, 7][[28, 128], 9, 7]Failed
oracle 7[[177, 31], 13, 3][[177, 24], 13, 3]Failed
variant packet 1[[129, 224, 255], 20, 4][[129, 224, 240], 20, 4]Failed

SHA-256 / 8a634af57af0a31107d8977bbf7ab57e0f92f9a14ffbdbcac5101f9f0aaffaae

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(codes, width, prefix):
    bits = list(prefix)
    for code in codes:
        bits.extend((code >> shift) & 1 for shift in range(width-1,-1,-1))
    padding = (-len(bits)) % 8
    bits += [bits[-1] if bits else 0] * padding
    out = []
    for start in range(0,len(bits),8):
        out.append(sum(bits[start+j] << (7-j) for j in range(8)))
    return [out, len(prefix)+len(codes)*width, padding]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 7], 3, [1, 0])), [[129, 224], 11, 5])
check('oracle 2', solve(*([5, 2], 3, [])), [[168], 6, 2])
check('oracle 3', solve(*([], 3, [])), [[], 0, 0])
check('oracle 4', solve(*([15, 0], 4, [])), [[240], 8, 0])
check('oracle 5', solve(*([1], 1, [1, 1, 0])), [[208], 4, 4])
check('oracle 6', solve(*([0, 3, 2, 1], 2, [0])), [[28, 128], 9, 7])
check('oracle 7', solve(*([17, 3], 5, [1, 0, 1])), [[177, 24], 13, 3])
if N == 1: check('variant packet 1', solve(*[[0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240], 20, 4])
if N == 2: check('variant packet 2', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120], 29, 3])
if N == 3: check('variant packet 3', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60], 38, 2])
if N == 4: check('variant packet 4', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30], 47, 1])
if N == 5: check('variant packet 5', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30, 15], 56, 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
oracle 1[[129, 255], 11, 5][[129, 224], 11, 5]Failed
oracle 2[[168], 6, 2][[168], 6, 2]Passed
oracle 3[[], 0, 0][[], 0, 0]Passed
oracle 4[[240], 8, 0][[240], 8, 0]Passed
oracle 5[[223], 4, 4][[208], 4, 4]Failed
oracle 6[[28, 255], 9, 7][[28, 128], 9, 7]Failed
oracle 7[[177, 31], 13, 3][[177, 24], 13, 3]Failed
variant packet 1[[129, 224, 255], 20, 4][[129, 224, 240], 20, 4]Failed

SHA-256 / f0b13678327d0a6e328c81e7d6d4ab16ddb88fcaeccd0993b4874c67a7dd0166

3 / The verified repair

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

N = 1
observations = []
def solve(codes, width, prefix):
    bits = list(prefix)
    for code in codes:
        bits.extend((code >> shift) & 1 for shift in range(width-1,-1,-1))
    padding = (-len(bits)) % 8
    bits += [0] * padding
    out = []
    for start in range(0,len(bits),8):
        out.append(sum(bits[start+j] << (7-j) for j in range(8)))
    return [out, len(prefix)+len(codes)*width, padding]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([0, 1, 7], 3, [1, 0])), [[129, 224], 11, 5])
check('oracle 2', solve(*([5, 2], 3, [])), [[168], 6, 2])
check('oracle 3', solve(*([], 3, [])), [[], 0, 0])
check('oracle 4', solve(*([15, 0], 4, [])), [[240], 8, 0])
check('oracle 5', solve(*([1], 1, [1, 1, 0])), [[208], 4, 4])
check('oracle 6', solve(*([0, 3, 2, 1], 2, [0])), [[28, 128], 9, 7])
check('oracle 7', solve(*([17, 3], 5, [1, 0, 1])), [[177, 24], 13, 3])
if N == 1: check('variant packet 1', solve(*[[0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240], 20, 4])
if N == 2: check('variant packet 2', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120], 29, 3])
if N == 3: check('variant packet 3', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60], 38, 2])
if N == 4: check('variant packet 4', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30], 47, 1])
if N == 5: check('variant packet 5', solve(*[[0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7, 0, 1, 7], 3, [1, 0]]), [[129, 224, 240, 120, 60, 30, 15], 56, 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
oracle 1[[129, 224], 11, 5][[129, 224], 11, 5]Passed
oracle 2[[168], 6, 2][[168], 6, 2]Passed
oracle 3[[], 0, 0][[], 0, 0]Passed
oracle 4[[240], 8, 0][[240], 8, 0]Passed
oracle 5[[208], 4, 4][[208], 4, 4]Passed
oracle 6[[28, 128], 9, 7][[28, 128], 9, 7]Passed
oracle 7[[177, 24], 13, 3][[177, 24], 13, 3]Passed
variant packet 1[[129, 224, 240], 20, 4][[129, 224, 240], 20, 4]Passed

SHA-256 / 1a6bacfd1831f882754c5a37ea36bf06a700319d8b5d2e8b37722f9b529e9506

Verification & scope

Stipulated finite model; no claim of hardware timing or full file-format conformance. 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:44:54.522388+00:00.

Case digest / f76dc1d800efe6250e738878440be48679efbd547e0f31b63e1e219a9ac9ffe6