Skip to main content
FORGEJO ERA / ISSUE #606

Switch table entries in javap output are parsed as instructions

closedOpened by MelanX on

Original description​

By MelanX · October 23, 2026

Crate: tools/minecraft-options

Commit: 2b2af1e4f8166d02e4732d19e040a53745d97a51

Behavior

Lines inside tableswitch and lookupswitch blocks ( 1: 100, 3135580: 59) match CODE_RE and become Insn objects with a numeric op. They pollute instruction windows ([i:i+40], [-6:]), and by_offset is built from ins.off, so a case value can overwrite a real instruction offset. legacy_load_blocks resolves branch targets with member.by_offset.get(branch).

Expected behavior

Only lines whose operation token starts with a letter are instructions.

Impact

A branch to offset N can resolve to a switch-case pseudo-instruction and move the end of a key's body. Re-running extract_legacy with pseudo-instructions filtered gave identical output for 1.12.2 to 1.16.5, so no wrong output is known today.

Locations

  • tools/minecraft-options/analyze_options.py CODE_RE (237), parse_members (282-302), Member.by_offset (279), legacy_load_blocks (~831)

Validation and limitations

Pseudo-instructions found in the root class of 1.12.2 (22), 1.16.5 (3), 1.18.2 (9), 1.21.x (8 to 10), and 26.x (10 to 11), with duplicate offsets in one to three members each.