FAILURE MAP
← Case archive

FA-48896 / PCM sample encoding / Open access

Validbit left container: valid mask · case 01

Bits above the declared container leak into the valid field.

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

ROOT CAUSE

Bits above the declared container leak into the valid field.

VERIFIED REPAIR

Use the stated conversion contract at valid mask.

Unsuccessful approach: Clearing the sign bit removes negative values.

Case contract

Extract a signed valid-bit field left justified in an unsigned container; ignore bits above the container and separately return low unused pad bits. valid<container.

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(words, valid, container):
    shift=container-valid
    mask=(1<<container)-1
    values=[]
    for word in words:
        code=(word>>shift)&mask
        sign=1<<(valid-1)
        values.append(code-(1<<valid) if code&sign else code)
    unused=[word&((1<<shift)-1) for word in words]
    return [values,unused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([3840, 1792, 256], 4, 12)), [[-1, 7, 1], [0, 0, 0]])
check('oracle 2', solve(*([128, 112, 0], 4, 8)), [[-8, 7, 0], [0, 0, 0]])
check('oracle 3', solve(*([384, 496], 4, 8)), [[-8, -1], [0, 0]])
check('oracle 4', solve(*([129, 114], 4, 8)), [[-8, 7], [1, 2]])
check('oracle 5', solve(*([], 3, 8)), [[], []])
check('oracle 6', solve(*([224, 32], 3, 8)), [[-1, 1], [0, 0]])
check('oracle 7', solve(*([4092, 4], 10, 12)), [[-1, 1], [0, 0]])
if N == 1: check('variant packet 1', solve(*[[3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0]])
if N == 2: check('variant packet 2', solve(*[[3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0]])
if N == 3: check('variant packet 3', solve(*[[3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
if N == 4: check('variant packet 4', solve(*[[3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
if N == 5: check('variant packet 5', solve(*[[3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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[[-1, 7, 1], [0, 0, 0]][[-1, 7, 1], [0, 0, 0]]Passed
oracle 2[[-8, 7, 0], [0, 0, 0]][[-8, 7, 0], [0, 0, 0]]Passed
oracle 3[[8, 15], [0, 0]][[-8, -1], [0, 0]]Failed
oracle 4[[-8, 7], [1, 2]][[-8, 7], [1, 2]]Passed
oracle 5[[], []][[], []]Passed
oracle 6[[-1, 1], [0, 0]][[-1, 1], [0, 0]]Passed
oracle 7[[-1, 1], [0, 0]][[-1, 1], [0, 0]]Passed
variant packet 1[[-1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0]][[-1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0]]Passed

SHA-256 / caf5bd724c0a005608a48e94a34e03020598b1116628bf1abeedefb082069e9e

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(words, valid, container):
    shift=container-valid
    mask=(1<<(valid-1))-1
    values=[]
    for word in words:
        code=(word>>shift)&mask
        sign=1<<(valid-1)
        values.append(code-(1<<valid) if code&sign else code)
    unused=[word&((1<<shift)-1) for word in words]
    return [values,unused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([3840, 1792, 256], 4, 12)), [[-1, 7, 1], [0, 0, 0]])
check('oracle 2', solve(*([128, 112, 0], 4, 8)), [[-8, 7, 0], [0, 0, 0]])
check('oracle 3', solve(*([384, 496], 4, 8)), [[-8, -1], [0, 0]])
check('oracle 4', solve(*([129, 114], 4, 8)), [[-8, 7], [1, 2]])
check('oracle 5', solve(*([], 3, 8)), [[], []])
check('oracle 6', solve(*([224, 32], 3, 8)), [[-1, 1], [0, 0]])
check('oracle 7', solve(*([4092, 4], 10, 12)), [[-1, 1], [0, 0]])
if N == 1: check('variant packet 1', solve(*[[3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0]])
if N == 2: check('variant packet 2', solve(*[[3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0]])
if N == 3: check('variant packet 3', solve(*[[3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
if N == 4: check('variant packet 4', solve(*[[3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
if N == 5: check('variant packet 5', solve(*[[3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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[[7, 7, 1], [0, 0, 0]][[-1, 7, 1], [0, 0, 0]]Failed
oracle 2[[0, 7, 0], [0, 0, 0]][[-8, 7, 0], [0, 0, 0]]Failed
oracle 3[[0, 7], [0, 0]][[-8, -1], [0, 0]]Failed
oracle 4[[0, 7], [1, 2]][[-8, 7], [1, 2]]Failed
oracle 5[[], []][[], []]Passed
oracle 6[[3, 1], [0, 0]][[-1, 1], [0, 0]]Failed
oracle 7[[511, 1], [0, 0]][[-1, 1], [0, 0]]Failed
variant packet 1[[7, 7, 1, 7, 7, 1], [0, 0, 0, 0, 0, 0]][[-1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0]]Failed

SHA-256 / 297ca4f89b62a1362506299f7701f8f1b3a6f681c12e1d574ef529dc4f2e7afa

3 / The verified repair

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

N = 1
observations = []
def solve(words, valid, container):
    shift=container-valid
    mask=(1<<valid)-1
    values=[]
    for word in words:
        code=(word>>shift)&mask
        sign=1<<(valid-1)
        values.append(code-(1<<valid) if code&sign else code)
    unused=[word&((1<<shift)-1) for word in words]
    return [values,unused]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oracle 1', solve(*([3840, 1792, 256], 4, 12)), [[-1, 7, 1], [0, 0, 0]])
check('oracle 2', solve(*([128, 112, 0], 4, 8)), [[-8, 7, 0], [0, 0, 0]])
check('oracle 3', solve(*([384, 496], 4, 8)), [[-8, -1], [0, 0]])
check('oracle 4', solve(*([129, 114], 4, 8)), [[-8, 7], [1, 2]])
check('oracle 5', solve(*([], 3, 8)), [[], []])
check('oracle 6', solve(*([224, 32], 3, 8)), [[-1, 1], [0, 0]])
check('oracle 7', solve(*([4092, 4], 10, 12)), [[-1, 1], [0, 0]])
if N == 1: check('variant packet 1', solve(*[[3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0]])
if N == 2: check('variant packet 2', solve(*[[3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0]])
if N == 3: check('variant packet 3', solve(*[[3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
if N == 4: check('variant packet 4', solve(*[[3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
if N == 5: check('variant packet 5', solve(*[[3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256, 3840, 1792, 256], 4, 12]), [[-1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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[[-1, 7, 1], [0, 0, 0]][[-1, 7, 1], [0, 0, 0]]Passed
oracle 2[[-8, 7, 0], [0, 0, 0]][[-8, 7, 0], [0, 0, 0]]Passed
oracle 3[[-8, -1], [0, 0]][[-8, -1], [0, 0]]Passed
oracle 4[[-8, 7], [1, 2]][[-8, 7], [1, 2]]Passed
oracle 5[[], []][[], []]Passed
oracle 6[[-1, 1], [0, 0]][[-1, 1], [0, 0]]Passed
oracle 7[[-1, 1], [0, 0]][[-1, 1], [0, 0]]Passed
variant packet 1[[-1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0]][[-1, 7, 1, -1, 7, 1], [0, 0, 0, 0, 0, 0]]Passed

SHA-256 / ca7293e7026af013c2db0a94ce1e628036256a4a01402c3fc8b3e0204e17275f

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

Case digest / 4419da8f3df7d3805fe930d04354282c5a1f1f86ad72d837cabd0fb56a7dc7db