FA-90321 / Bytecode virtual machines / Open access
Stack map frames: extended one-item frame rejected as reserved · case 01
Methods using frame type 247 fail verification.
ROOT CAUSE
The reserved range check includes 247.
VERIFIED REPAIR
Only types 128 through 246 are reserved.
Unsuccessful approach: Stopping the reserved range at 245 treats 246 as a chop frame.
Case contract
Expand compressed stack map frames. Types: 0-63 same (delta = type), 64-127 same_locals_1_stack_item (delta = type - 64, one stack item), 128-246 reserved (["ClassFormatError", index]), 247 extended one item [247, delta, item], 248-250 chop 251-type locals [t, delta], 251 same extended [251, delta], 252-254 append type-251 locals [t, delta, items...], 255 full [255, delta, locals, stack]. The first frame's offset is its delta; each later offset is previous + delta + 1. Chopping more locals than exist is an error. Return [offset, locals, stack] for every frame; each frame's locals are an independent snapshot.
Why this case matters
Verifiers reconstruct per-offset types from this compressed encoding; any slip mistypes locals.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(initial, frames):
locals_ = list(initial)
out = []
offset = 0
for idx, fr in enumerate(frames):
t = fr[0]
stack = []
if t <= 63:
delta = t
elif t <= 127:
delta = t - 64
stack = [fr[1]]
elif t <= 247:
return ['ClassFormatError', idx]
elif t == 247:
delta = fr[1]
stack = [fr[2]]
elif t <= 250:
delta = fr[1]
k = 251 - t
if k > len(locals_):
return ['ClassFormatError', idx]
locals_ = locals_[:len(locals_) - k]
elif t == 251:
delta = fr[1]
elif t <= 254:
delta = fr[1]
locals_ = locals_ + list(fr[2:2 + t - 251])
else:
delta = fr[1]
locals_ = list(fr[2])
stack = list(fr[3])
offset = delta if idx == 0 else offset + delta + 1
out.append([offset, locals_, stack])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [71, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[13, ['I', 'Object'], ['I']],
[17, ['I', 'Object', 'F'], []],
[20, ['I'], []],
[321, ['I'], []],
[323, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[11], [3]]),
[[11, ['I', 'Object'], []], [15, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[65, 'Object'], [64, 'I']]),
[[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 5, 'Object']]),
[[5, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 1], [251, 0]]), [[1, [], []], [2, [], []]]),
('chop more locals than exist', ([], [[250, 1]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 1, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[2, ['I', 'Object', 'I', 'I', 'F'], []],
[3, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 1, ['Object'], []], [2]]),
[[1, ['Object'], []], [4, ['Object'], []]])],
[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [72, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[14, ['I', 'Object'], ['I']],
[18, ['I', 'Object', 'F'], []],
[21, ['I'], []],
[322, ['I'], []],
[324, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[12], [3]]),
[[12, ['I', 'Object'], []], [16, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[66, 'Object'], [64, 'I']]),
[[2, ['I', 'Object'], ['Object']], [3, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 6, 'Object']]),
[[6, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 2], [251, 0]]), [[2, [], []], [3, [], []]]),
('chop more locals than exist', ([], [[250, 2]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 2, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[3, ['I', 'Object', 'I', 'I', 'F'], []],
[4, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 2, ['Object'], []], [2]]),
[[2, ['Object'], []], [5, ['Object'], []]])],
[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [73, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[15, ['I', 'Object'], ['I']],
[19, ['I', 'Object', 'F'], []],
[22, ['I'], []],
[323, ['I'], []],
[325, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[13], [3]]),
[[13, ['I', 'Object'], []], [17, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[67, 'Object'], [64, 'I']]),
[[3, ['I', 'Object'], ['Object']], [4, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 7, 'Object']]),
[[7, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 3], [251, 0]]), [[3, [], []], [4, [], []]]),
('chop more locals than exist', ([], [[250, 3]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 3, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[4, ['I', 'Object', 'I', 'I', 'F'], []],
[5, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 3, ['Object'], []], [2]]),
[[3, ['Object'], []], [6, ['Object'], []]])],
[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [74, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[16, ['I', 'Object'], ['I']],
[20, ['I', 'Object', 'F'], []],
[23, ['I'], []],
[324, ['I'], []],
[326, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[14], [3]]),
[[14, ['I', 'Object'], []], [18, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[68, 'Object'], [64, 'I']]),
[[4, ['I', 'Object'], ['Object']], [5, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 8, 'Object']]),
[[8, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 4], [251, 0]]), [[4, [], []], [5, [], []]]),
('chop more locals than exist', ([], [[250, 4]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 4, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[5, ['I', 'Object', 'I', 'I', 'F'], []],
[6, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 4, ['Object'], []], [2]]),
[[4, ['Object'], []], [7, ['Object'], []]])],
[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [75, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[17, ['I', 'Object'], ['I']],
[21, ['I', 'Object', 'F'], []],
[24, ['I'], []],
[325, ['I'], []],
[327, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[15], [3]]),
[[15, ['I', 'Object'], []], [19, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[69, 'Object'], [64, 'I']]),
[[5, ['I', 'Object'], ['Object']], [6, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 9, 'Object']]),
[[9, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 5], [251, 0]]), [[5, [], []], [6, [], []]]),
('chop more locals than exist', ([], [[250, 5]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 5, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[6, ['I', 'Object', 'I', 'I', 'F'], []],
[7, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 5, ['Object'], []], [2]]),
[[5, ['Object'], []], [8, ['Object'], []]])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: every compressed frame kind | [[5, ['I', 'Object'], []], [13, ['I', 'Object'], ['I']], [17, ['I', 'Object', 'F'], []], [20, ['I'], []], [321, ['I'], []], [323, ['I'], ['Object', 'J']]] | [[5, ['I', 'Object'], []], [13, ['I', 'Object'], ['I']], [17, ['I', 'Object', 'F'], []], [20, ['I'], []], [321, ['I'], []], [323, ['I'], ['Object', 'J']]] | Passed |
| first frame offset is its delta | [[11, ['I', 'Object'], []], [15, ['I', 'Object'], []]] | [[11, ['I', 'Object'], []], [15, ['I', 'Object'], []]] | Passed |
| same_locals_1_stack_item delta | [[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]] | [[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]] | Passed |
| reserved frame type | ['ClassFormatError', 1] | ['ClassFormatError', 1] | Passed |
| extended one-item frame type | ['ClassFormatError', 0] | [[5, ['I', 'Object'], ['Object']]] | Failed |
| chop three locals | [[1, [], []], [2, [], []]] | [[1, [], []], [2, [], []]] | Passed |
| chop more locals than exist | ['ClassFormatError', 0] | ['ClassFormatError', 0] | Passed |
| append three locals then snapshot | [[0, ['I', 'Object'], []], [2, ['I', 'Object', 'I', 'I', 'F'], []], [3, ['I', 'Object', 'I', 'I', 'F'], []]] | [[0, ['I', 'Object'], []], [2, ['I', 'Object', 'I', 'I', 'F'], []], [3, ['I', 'Object', 'I', 'I', 'F'], []]] | Passed |
| control: full frame replaces locals | [[1, ['Object'], []], [4, ['Object'], []]] | [[1, ['Object'], []], [4, ['Object'], []]] | Passed |
SHA-256 / 3a12a3b7801a1e743291d96fc8840e6d142f06196fe1dd29d46e7ff4a453a2ad
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(initial, frames):
locals_ = list(initial)
out = []
offset = 0
for idx, fr in enumerate(frames):
t = fr[0]
stack = []
if t <= 63:
delta = t
elif t <= 127:
delta = t - 64
stack = [fr[1]]
elif t < 246:
return ['ClassFormatError', idx]
elif t == 247:
delta = fr[1]
stack = [fr[2]]
elif t <= 250:
delta = fr[1]
k = 251 - t
if k > len(locals_):
return ['ClassFormatError', idx]
locals_ = locals_[:len(locals_) - k]
elif t == 251:
delta = fr[1]
elif t <= 254:
delta = fr[1]
locals_ = locals_ + list(fr[2:2 + t - 251])
else:
delta = fr[1]
locals_ = list(fr[2])
stack = list(fr[3])
offset = delta if idx == 0 else offset + delta + 1
out.append([offset, locals_, stack])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [71, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[13, ['I', 'Object'], ['I']],
[17, ['I', 'Object', 'F'], []],
[20, ['I'], []],
[321, ['I'], []],
[323, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[11], [3]]),
[[11, ['I', 'Object'], []], [15, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[65, 'Object'], [64, 'I']]),
[[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 5, 'Object']]),
[[5, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 1], [251, 0]]), [[1, [], []], [2, [], []]]),
('chop more locals than exist', ([], [[250, 1]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 1, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[2, ['I', 'Object', 'I', 'I', 'F'], []],
[3, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 1, ['Object'], []], [2]]),
[[1, ['Object'], []], [4, ['Object'], []]])],
[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [72, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[14, ['I', 'Object'], ['I']],
[18, ['I', 'Object', 'F'], []],
[21, ['I'], []],
[322, ['I'], []],
[324, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[12], [3]]),
[[12, ['I', 'Object'], []], [16, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[66, 'Object'], [64, 'I']]),
[[2, ['I', 'Object'], ['Object']], [3, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 6, 'Object']]),
[[6, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 2], [251, 0]]), [[2, [], []], [3, [], []]]),
('chop more locals than exist', ([], [[250, 2]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 2, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[3, ['I', 'Object', 'I', 'I', 'F'], []],
[4, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 2, ['Object'], []], [2]]),
[[2, ['Object'], []], [5, ['Object'], []]])],
[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [73, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[15, ['I', 'Object'], ['I']],
[19, ['I', 'Object', 'F'], []],
[22, ['I'], []],
[323, ['I'], []],
[325, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[13], [3]]),
[[13, ['I', 'Object'], []], [17, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[67, 'Object'], [64, 'I']]),
[[3, ['I', 'Object'], ['Object']], [4, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 7, 'Object']]),
[[7, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 3], [251, 0]]), [[3, [], []], [4, [], []]]),
('chop more locals than exist', ([], [[250, 3]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 3, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[4, ['I', 'Object', 'I', 'I', 'F'], []],
[5, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 3, ['Object'], []], [2]]),
[[3, ['Object'], []], [6, ['Object'], []]])],
[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [74, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[16, ['I', 'Object'], ['I']],
[20, ['I', 'Object', 'F'], []],
[23, ['I'], []],
[324, ['I'], []],
[326, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[14], [3]]),
[[14, ['I', 'Object'], []], [18, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[68, 'Object'], [64, 'I']]),
[[4, ['I', 'Object'], ['Object']], [5, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 8, 'Object']]),
[[8, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 4], [251, 0]]), [[4, [], []], [5, [], []]]),
('chop more locals than exist', ([], [[250, 4]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 4, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[5, ['I', 'Object', 'I', 'I', 'F'], []],
[6, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 4, ['Object'], []], [2]]),
[[4, ['Object'], []], [7, ['Object'], []]])],
[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [75, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[17, ['I', 'Object'], ['I']],
[21, ['I', 'Object', 'F'], []],
[24, ['I'], []],
[325, ['I'], []],
[327, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[15], [3]]),
[[15, ['I', 'Object'], []], [19, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[69, 'Object'], [64, 'I']]),
[[5, ['I', 'Object'], ['Object']], [6, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 9, 'Object']]),
[[9, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 5], [251, 0]]), [[5, [], []], [6, [], []]]),
('chop more locals than exist', ([], [[250, 5]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 5, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[6, ['I', 'Object', 'I', 'I', 'F'], []],
[7, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 5, ['Object'], []], [2]]),
[[5, ['Object'], []], [8, ['Object'], []]])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: every compressed frame kind | [[5, ['I', 'Object'], []], [13, ['I', 'Object'], ['I']], [17, ['I', 'Object', 'F'], []], [20, ['I'], []], [321, ['I'], []], [323, ['I'], ['Object', 'J']]] | [[5, ['I', 'Object'], []], [13, ['I', 'Object'], ['I']], [17, ['I', 'Object', 'F'], []], [20, ['I'], []], [321, ['I'], []], [323, ['I'], ['Object', 'J']]] | Passed |
| first frame offset is its delta | [[11, ['I', 'Object'], []], [15, ['I', 'Object'], []]] | [[11, ['I', 'Object'], []], [15, ['I', 'Object'], []]] | Passed |
| same_locals_1_stack_item delta | [[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]] | [[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]] | Passed |
| reserved frame type | [[1, ['I', 'I', 'J', 'F', 'Object', 'D'], []], [2, ['I'], []]] | ['ClassFormatError', 1] | Failed |
| extended one-item frame type | [[5, ['I', 'Object'], ['Object']]] | [[5, ['I', 'Object'], ['Object']]] | Passed |
| chop three locals | [[1, [], []], [2, [], []]] | [[1, [], []], [2, [], []]] | Passed |
| chop more locals than exist | ['ClassFormatError', 0] | ['ClassFormatError', 0] | Passed |
| append three locals then snapshot | [[0, ['I', 'Object'], []], [2, ['I', 'Object', 'I', 'I', 'F'], []], [3, ['I', 'Object', 'I', 'I', 'F'], []]] | [[0, ['I', 'Object'], []], [2, ['I', 'Object', 'I', 'I', 'F'], []], [3, ['I', 'Object', 'I', 'I', 'F'], []]] | Passed |
| control: full frame replaces locals | [[1, ['Object'], []], [4, ['Object'], []]] | [[1, ['Object'], []], [4, ['Object'], []]] | Passed |
SHA-256 / 1d2d0f3852bb94b94b66f122204ce1ca849a023c507b9fb4f95a9168653cbd67
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(initial, frames):
locals_ = list(initial)
out = []
offset = 0
for idx, fr in enumerate(frames):
t = fr[0]
stack = []
if t <= 63:
delta = t
elif t <= 127:
delta = t - 64
stack = [fr[1]]
elif t < 247:
return ['ClassFormatError', idx]
elif t == 247:
delta = fr[1]
stack = [fr[2]]
elif t <= 250:
delta = fr[1]
k = 251 - t
if k > len(locals_):
return ['ClassFormatError', idx]
locals_ = locals_[:len(locals_) - k]
elif t == 251:
delta = fr[1]
elif t <= 254:
delta = fr[1]
locals_ = locals_ + list(fr[2:2 + t - 251])
else:
delta = fr[1]
locals_ = list(fr[2])
stack = list(fr[3])
offset = delta if idx == 0 else offset + delta + 1
out.append([offset, locals_, stack])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [71, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[13, ['I', 'Object'], ['I']],
[17, ['I', 'Object', 'F'], []],
[20, ['I'], []],
[321, ['I'], []],
[323, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[11], [3]]),
[[11, ['I', 'Object'], []], [15, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[65, 'Object'], [64, 'I']]),
[[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 5, 'Object']]),
[[5, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 1], [251, 0]]), [[1, [], []], [2, [], []]]),
('chop more locals than exist', ([], [[250, 1]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 1, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[2, ['I', 'Object', 'I', 'I', 'F'], []],
[3, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 1, ['Object'], []], [2]]),
[[1, ['Object'], []], [4, ['Object'], []]])],
[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [72, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[14, ['I', 'Object'], ['I']],
[18, ['I', 'Object', 'F'], []],
[21, ['I'], []],
[322, ['I'], []],
[324, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[12], [3]]),
[[12, ['I', 'Object'], []], [16, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[66, 'Object'], [64, 'I']]),
[[2, ['I', 'Object'], ['Object']], [3, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 6, 'Object']]),
[[6, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 2], [251, 0]]), [[2, [], []], [3, [], []]]),
('chop more locals than exist', ([], [[250, 2]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 2, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[3, ['I', 'Object', 'I', 'I', 'F'], []],
[4, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 2, ['Object'], []], [2]]),
[[2, ['Object'], []], [5, ['Object'], []]])],
[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [73, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[15, ['I', 'Object'], ['I']],
[19, ['I', 'Object', 'F'], []],
[22, ['I'], []],
[323, ['I'], []],
[325, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[13], [3]]),
[[13, ['I', 'Object'], []], [17, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[67, 'Object'], [64, 'I']]),
[[3, ['I', 'Object'], ['Object']], [4, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 7, 'Object']]),
[[7, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 3], [251, 0]]), [[3, [], []], [4, [], []]]),
('chop more locals than exist', ([], [[250, 3]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 3, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[4, ['I', 'Object', 'I', 'I', 'F'], []],
[5, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 3, ['Object'], []], [2]]),
[[3, ['Object'], []], [6, ['Object'], []]])],
[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [74, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[16, ['I', 'Object'], ['I']],
[20, ['I', 'Object', 'F'], []],
[23, ['I'], []],
[324, ['I'], []],
[326, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[14], [3]]),
[[14, ['I', 'Object'], []], [18, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[68, 'Object'], [64, 'I']]),
[[4, ['I', 'Object'], ['Object']], [5, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 8, 'Object']]),
[[8, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 4], [251, 0]]), [[4, [], []], [5, [], []]]),
('chop more locals than exist', ([], [[250, 4]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 4, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[5, ['I', 'Object', 'I', 'I', 'F'], []],
[6, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 4, ['Object'], []], [2]]),
[[4, ['Object'], []], [7, ['Object'], []]])],
[('regression: every compressed frame kind',
(['I', 'Object'], [[5], [75, 'I'], [252, 3, 'F'], [249, 2], [251, 300], [255, 1, ['I'], ['Object', 'J']]]),
[[5, ['I', 'Object'], []],
[17, ['I', 'Object'], ['I']],
[21, ['I', 'Object', 'F'], []],
[24, ['I'], []],
[325, ['I'], []],
[327, ['I'], ['Object', 'J']]]),
('first frame offset is its delta',
(['I', 'Object'], [[15], [3]]),
[[15, ['I', 'Object'], []], [19, ['I', 'Object'], []]]),
('same_locals_1_stack_item delta',
(['I', 'Object'], [[69, 'Object'], [64, 'I']]),
[[5, ['I', 'Object'], ['Object']], [6, ['I', 'Object'], ['I']]]),
('reserved frame type', (['I', 'I', 'J', 'F', 'Object', 'D'], [[1], [246, 0]]), ['ClassFormatError', 1]),
('extended one-item frame type',
(['I', 'Object'], [[247, 9, 'Object']]),
[[9, ['I', 'Object'], ['Object']]]),
('chop three locals', (['I', 'J', 'F'], [[248, 5], [251, 0]]), [[5, [], []], [6, [], []]]),
('chop more locals than exist', ([], [[250, 5]]), ['ClassFormatError', 0]),
('append three locals then snapshot',
(['I', 'Object'], [[0], [254, 5, 'I', 'I', 'F'], [0]]),
[[0, ['I', 'Object'], []],
[6, ['I', 'Object', 'I', 'I', 'F'], []],
[7, ['I', 'Object', 'I', 'I', 'F'], []]]),
('control: full frame replaces locals',
(['I', 'Object'], [[255, 5, ['Object'], []], [2]]),
[[5, ['Object'], []], [8, ['Object'], []]])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: every compressed frame kind | [[5, ['I', 'Object'], []], [13, ['I', 'Object'], ['I']], [17, ['I', 'Object', 'F'], []], [20, ['I'], []], [321, ['I'], []], [323, ['I'], ['Object', 'J']]] | [[5, ['I', 'Object'], []], [13, ['I', 'Object'], ['I']], [17, ['I', 'Object', 'F'], []], [20, ['I'], []], [321, ['I'], []], [323, ['I'], ['Object', 'J']]] | Passed |
| first frame offset is its delta | [[11, ['I', 'Object'], []], [15, ['I', 'Object'], []]] | [[11, ['I', 'Object'], []], [15, ['I', 'Object'], []]] | Passed |
| same_locals_1_stack_item delta | [[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]] | [[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]] | Passed |
| reserved frame type | ['ClassFormatError', 1] | ['ClassFormatError', 1] | Passed |
| extended one-item frame type | [[5, ['I', 'Object'], ['Object']]] | [[5, ['I', 'Object'], ['Object']]] | Passed |
| chop three locals | [[1, [], []], [2, [], []]] | [[1, [], []], [2, [], []]] | Passed |
| chop more locals than exist | ['ClassFormatError', 0] | ['ClassFormatError', 0] | Passed |
| append three locals then snapshot | [[0, ['I', 'Object'], []], [2, ['I', 'Object', 'I', 'I', 'F'], []], [3, ['I', 'Object', 'I', 'I', 'F'], []]] | [[0, ['I', 'Object'], []], [2, ['I', 'Object', 'I', 'I', 'F'], []], [3, ['I', 'Object', 'I', 'I', 'F'], []]] | Passed |
| control: full frame replaces locals | [[1, ['Object'], []], [4, ['Object'], []]] | [[1, ['Object'], []], [4, ['Object'], []]] | Passed |
SHA-256 / a1e4f2597be70b86de5251cdab6fe6ae3a4f73edc84db53cdecc2e859bfe058a
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.677833+00:00.
Case digest / 54ca57a98761946ed58e76f3eb1d0245277351b499abe5a36458f80c542f31cf