From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:ABC" |
|---|
| claim | "Branch opcodes (jump 0x10, if* 0x0C-0x1A) carry a 3-byte signed i24 offset relative to the next instruction; lookupswitch (0x1B) carries i24 default offset, u30 case_count-1, then case_count i24 offsets, all relative to the start of the lookupswitch instruction (not the next instruction); pushbyte has a u8 operand, pushshort a u30 cast to i16; getlocal/setlocal/kill/inclocal take a u30 register, the _0.._3 forms none; call takes u30 argc, callproperty/callpropvoid/constructprop take a multiname index then u30 argc; debug takes u8 type, u30 name index, u8 register and a u30 that is ignored." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:ABC" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "decoding AVM2 code" |
|---|
| effect | "fixes instruction lengths so a linear disassembly stays in sync" |
|---|
| function | "Reader::read_op" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "Debug, IfEq, Jump, LookupSwitch (num_cases = u30 + 1), PushByte, PushShort arms of read_op; read_i24 at lines 83-87 is little-endian with the top byte sign-extended. Relative-to-next-instruction is the AVM2 overview convention (Unverified in this source: the offset is only stored here)." |
|---|
| repo | "https://github.com/ruffle-rs/ruffle" |
|---|
| commit | "ea24ef78aa6c898e8170c1a603a496dd1131bd6c" |
|---|
| path | "swf/src/avm2/read.rs" |
|---|
| lines | "512-520, 595-598, 654-657, 668-673, 703-722" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Opcode operand encodings" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T08:46:51.592Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T11:48:56.172Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read ruffle swf read.rs (read_i24 little endian, arms for Debug, If*, Jump, LookupSwitch (u30+1), PushByte/PushShort, call and local ops) and core verify.rs lines 150-235 at ea24ef7: branch target = offset + position after the instruction, switch targets = offset + previous_position (instruction start)." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T09:34:03.898Z" |
|---|
| summary | "Base of the switch offsets was left out: ruffle's verifier (core/src/avm2/verify.rs 190-230) resolves conditional jumps as offset + position after the instruction, but lookupswitch default and case…" |
|---|
| changed | |
|---|
|
|
|---|