Search code examples
actionscript-3flashactionscriptactionscript-2

bitwise math regarding actionscript tags in swf


I'm trying to intelligently parse actionscript tags, Ive check the source for several open source programs that disassemble/decompile swf files.

Checking the doc on pg29 it states

"Note: The TagCodeAndLength field is a two-byte word, not a bit field of 10 bits followed by a bit field of 6 bits. The little-endian byte ordering of a SWF file makes these two layouts different."

Checking in 010 Editor, the first tag is

0x44 0x11 

which somehow translates to 0x45 (then the length). However, by the doc (quoted above), it doesnt make any sense as it appears to be:

0100 0100 0001 0001

which doesnt even remotely appear to be

0110 1001

Can someone please explain?


Solution

  • LE order means that a two-byte value 0100 0100 0001 0001 should be read as 0001 0001 0100 0100 (byte order reversed), which is a short header for tag 1000101 (0x45, dec 69) with a length of 0x100 (dec 4).