FAILURE MAP
← Case archive

FA-90256 / Bytecode virtual machines / Open access

Switch dispatch: four padding bytes when already aligned · case 01

Switches whose operands already start on a 4-byte boundary read every word four bytes late.

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

ROOT CAUSE

The padding formula lacks the final % 4, so zero padding becomes four.

THE FAILURE

The padding formula lacks the final % 4, so zero padding becomes four.

Unsuccessful approach: Aligning relative to the opcode address instead of the byte after it is off by one byte of padding.

Case contract

code is a method's bytes; at addr is tableswitch (0xAA) or lookupswitch (0xAB). After the opcode, 0-3 padding bytes align the next byte to a multiple of 4 from the method start; then big-endian signed 32-bit words: default, and either low, high and high-low+1 offsets, or npairs followed by sorted (match, offset) pairs. Branch offsets are relative to the switch opcode address. Return the target address, or ["VerifyError", reason] for low > high, negative npairs, keys not strictly increasing, another opcode, or truncated operands.

Why this case matters

Switch opcodes combine alignment, signed decoding and relative targets in one instruction.

1 / The failure

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

N = 1
observations = []
def solve(code, addr, key):
    def s32(p):
        v = (code[p] << 24) | (code[p + 1] << 16) | (code[p + 2] << 8) | code[p + 3]
        return v - (1 << 32) if v & 0x80000000 else v
    def dispatch():
        op = code[addr]
        p = addr + 1
        p += 4 - p % 4
        default = s32(p)
        if op == 0xAA:
            low, high = s32(p + 4), s32(p + 8)
            if low > high:
                return ['VerifyError', 'low>high']
            if low <= key <= high:
                return addr + s32(p + 12 + 4 * (key - low))
            return addr + default
        if op == 0xAB:
            npairs = s32(p + 4)
            if npairs < 0:
                return ['VerifyError', 'npairs']
            pairs = [(s32(p + 8 + 8 * i), s32(p + 12 + 8 * i)) for i in range(npairs)]
            if any(pairs[i][0] >= pairs[i + 1][0] for i in range(npairs - 1)):
                return ['VerifyError', 'unsorted']
            lo, hi = 0, npairs - 1
            while lo <= hi:
                mid = (lo + hi) // 2
                if pairs[mid][0] == key:
                    return addr + pairs[mid][1]
                if pairs[mid][0] < key:
                    lo = mid + 1
                else:
                    hi = mid - 1
            return addr + default
        return ['VerifyError', 'opcode']
    try:
        return dispatch()
    except IndexError:
        return ['VerifyError', 'truncated']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    7,
    0),
   47),
  ('tableswitch hit at the high bound',
   ([0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    1,
    1),
   51),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    -2),
   22),
  ('tableswitch miss takes the backward default',
   ([0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    1,
    5),
   -7),
  ('lookupswitch hit with negative offset',
   ([0,
     171,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    1,
    100),
   -3),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    7,
    3),
   19),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 171, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 1, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 170, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 1, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    11,
    0),
   51),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    1),
   52),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    -2),
   23),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    5),
   -6),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     171,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    2,
    100),
   -2),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    11,
    3),
   23),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 171, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 2, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 170, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 2, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    15,
    0),
   55),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    1),
   53),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    -2),
   24),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    5),
   -5),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    3,
    100),
   -1),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    15,
    3),
   27),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 171, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 3, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 170, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 3, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    19,
    0),
   59),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    1),
   54),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    -2),
   25),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    5),
   -4),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     36,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    4,
    100),
   0),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     36,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    19,
    3),
   31),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177],
    4,
    1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 0, 170, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 4, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    23,
    0),
   63),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    1),
   55),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    6,
    -2),
   26),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    5),
   -3),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     37,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    5,
    100),
   1),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     37,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    23,
    3),
   35),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177],
    5,
    1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 0, 0, 170, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 5, 3),
   ['VerifyError', 'low>high'])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
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
regression: tableswitch hit with aligned operands547Failed
tableswitch hit at the high bound5151Passed
tableswitch hit at the low bound2222Passed
tableswitch miss takes the backward default-7-7Passed
lookupswitch hit with negative offset-3-3Passed
lookupswitch miss['VerifyError', 'npairs']19Failed
lookupswitch with duplicate keys is rejected['VerifyError', 'unsorted']['VerifyError', 'unsorted']Passed
control: low greater than high['VerifyError', 'low>high']['VerifyError', 'low>high']Passed

SHA-256 / e212ee0e8bcf7ce91f96d42394553fb6f2a0adbe0c8e9f64bb9753d9da5838bc

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(code, addr, key):
    def s32(p):
        v = (code[p] << 24) | (code[p + 1] << 16) | (code[p + 2] << 8) | code[p + 3]
        return v - (1 << 32) if v & 0x80000000 else v
    def dispatch():
        op = code[addr]
        p = addr + 1
        p += (4 - addr % 4) % 4
        default = s32(p)
        if op == 0xAA:
            low, high = s32(p + 4), s32(p + 8)
            if low > high:
                return ['VerifyError', 'low>high']
            if low <= key <= high:
                return addr + s32(p + 12 + 4 * (key - low))
            return addr + default
        if op == 0xAB:
            npairs = s32(p + 4)
            if npairs < 0:
                return ['VerifyError', 'npairs']
            pairs = [(s32(p + 8 + 8 * i), s32(p + 12 + 8 * i)) for i in range(npairs)]
            if any(pairs[i][0] >= pairs[i + 1][0] for i in range(npairs - 1)):
                return ['VerifyError', 'unsorted']
            lo, hi = 0, npairs - 1
            while lo <= hi:
                mid = (lo + hi) // 2
                if pairs[mid][0] == key:
                    return addr + pairs[mid][1]
                if pairs[mid][0] < key:
                    lo = mid + 1
                else:
                    hi = mid - 1
            return addr + default
        return ['VerifyError', 'opcode']
    try:
        return dispatch()
    except IndexError:
        return ['VerifyError', 'truncated']
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    7,
    0),
   47),
  ('tableswitch hit at the high bound',
   ([0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    1,
    1),
   51),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    -2),
   22),
  ('tableswitch miss takes the backward default',
   ([0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     31,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    1,
    5),
   -7),
  ('lookupswitch hit with negative offset',
   ([0,
     171,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    1,
    100),
   -3),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    7,
    3),
   19),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 171, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 1, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 170, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 1, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    11,
    0),
   51),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    1),
   52),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    -2),
   23),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     32,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    2,
    5),
   -6),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     171,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    2,
    100),
   -2),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    11,
    3),
   23),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 171, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 2, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 170, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 2, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    15,
    0),
   55),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    1),
   53),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    -2),
   24),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     33,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    3,
    5),
   -5),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    3,
    100),
   -1),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    15,
    3),
   27),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 171, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177], 3, 1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 170, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 3, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    19,
    0),
   59),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    1),
   54),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    -2),
   25),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     0,
     170,
     0,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     34,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    4,
    5),
   -4),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     36,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    4,
    100),
   0),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     36,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    19,
    3),
   31),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177],
    4,
    1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 0, 170, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 4, 3),
   ['VerifyError', 'low>high'])],
 [('regression: tableswitch hit with aligned operands',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     170,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    23,
    0),
   63),
  ('tableswitch hit at the high bound',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    1),
   55),
  ('tableswitch hit at the low bound',
   ([0,
     0,
     0,
     0,
     0,
     0,
     170,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    6,
    -2),
   26),
  ('tableswitch miss takes the backward default',
   ([0,
     0,
     0,
     0,
     0,
     170,
     0,
     0,
     255,
     255,
     255,
     248,
     255,
     255,
     255,
     254,
     0,
     0,
     0,
     1,
     0,
     0,
     0,
     20,
     0,
     0,
     0,
     35,
     0,
     0,
     0,
     40,
     0,
     0,
     0,
     50,
     177],
    5,
    5),
   -3),
  ('lookupswitch hit with negative offset',
   ([0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     37,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    5,
    100),
   1),
  ('lookupswitch miss',
   ([0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     171,
     0,
     0,
     0,
     12,
     0,
     0,
     0,
     4,
     255,
     255,
     255,
     251,
     0,
     0,
     0,
     16,
     0,
     0,
     0,
     0,
     0,
     0,
     0,
     24,
     0,
     0,
     0,
     7,
     0,
     0,
     0,
     37,
     0,
     0,
     0,
     100,
     255,
     255,
     255,
     252,
     177],
    23,
    3),
   35),
  ('lookupswitch with duplicate keys is rejected',
   ([0, 0, 0, 0, 0, 171, 0, 0, 0, 0, 0, 12, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 1, 0, 0, 0, 12, 177],
    5,
    1),
   ['VerifyError', 'unsorted']),
  ('control: low greater than high',
   ([0, 0, 0, 0, 0, 170, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 2, 177], 5, 3),
   ['VerifyError', 'low>high'])]]
for label, args, expected in cases[N - 1]:
    check(label, solve(*args), expected)
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
regression: tableswitch hit with aligned operands['VerifyError', 'truncated']47Failed
tableswitch hit at the high bound['VerifyError', 'truncated']51Failed
tableswitch hit at the low bound['VerifyError', 'truncated']22Failed
tableswitch miss takes the backward default['VerifyError', 'truncated']-7Failed
lookupswitch hit with negative offset['VerifyError', 'truncated']-3Failed
lookupswitch miss['VerifyError', 'truncated']19Failed
lookupswitch with duplicate keys is rejected['VerifyError', 'truncated']['VerifyError', 'unsorted']Failed
control: low greater than high['VerifyError', 'low>high']['VerifyError', 'low>high']Passed

SHA-256 / e6b16dbf261ff24ce184a408011741e07620c472a2095215229e5d7ffca10959

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

A deterministic, bounded teaching model of one bytecode virtual machine mechanism with a stipulated instruction encoding; it is not a production VM and claims no conformance to any real specification. 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:51:25.170552+00:00.

Case digest / 52d80f2de79356b349720ec70094d85e4c68b5da591b25f86967566ae349e610