FA-90316 / Bytecode virtual machines / Open access
Stack map frames: one-item frame delta not rebased · case 01
same_locals_1_stack_item frames land 64 bytes too far.
ROOT CAUSE
The frame type is used as the delta without subtracting 64.
VERIFIED REPAIR
Subtract 64 from the type to get the delta.
Unsuccessful approach: Subtracting 63 is one byte off.
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
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'], []], [77, ['I', 'Object'], ['I']], [81, ['I', 'Object', 'F'], []], [84, ['I'], []], [385, ['I'], []], [387, ['I'], ['Object', 'J']]] | [[5, ['I', 'Object'], []], [13, ['I', 'Object'], ['I']], [17, ['I', 'Object', 'F'], []], [20, ['I'], []], [321, ['I'], []], [323, ['I'], ['Object', 'J']]] | Failed |
| 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 | [[65, ['I', 'Object'], ['Object']], [130, ['I', 'Object'], ['I']]] | [[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]] | Failed |
| 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 / eac92535b7c4d96389aeaa29f5a2f9c52fbd9c549263e5bb00581a30549212a9
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 - 63
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'], []], [14, ['I', 'Object'], ['I']], [18, ['I', 'Object', 'F'], []], [21, ['I'], []], [322, ['I'], []], [324, ['I'], ['Object', 'J']]] | [[5, ['I', 'Object'], []], [13, ['I', 'Object'], ['I']], [17, ['I', 'Object', 'F'], []], [20, ['I'], []], [321, ['I'], []], [323, ['I'], ['Object', 'J']]] | Failed |
| 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 | [[2, ['I', 'Object'], ['Object']], [4, ['I', 'Object'], ['I']]] | [[1, ['I', 'Object'], ['Object']], [2, ['I', 'Object'], ['I']]] | Failed |
| 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 / 0e2328a334ed2def889d0f90f1af0342f0eddad7f8d4f9d0f496f6fd08074ddc
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.678675+00:00.
Case digest / 8ae4805c6d8f2bec735402304aba1f5e2d842ee4ddbbb17899139b76f3f96f76