Instructions whose values rely on their size can cause the assembler to crash
Closed this issue · 0 comments
NewDefectus commented
E.g. jmp end - 0x81; end:
forces the assembler into an infinite loop, alternating between 2-byte and 5-byte encodings.
push $. - end + 0x81; end:
crashes for the same reason, as well as push $end - . - 0x82; end:
Note that gcc assembles these correctly:
jmp end - 0x81; end:
becomesE9 7F FF FF FF
push $. - end + 0x81; end:
becomes68 7C 00 00 00
push $end - . - 0x82; end:
becomes68 83 FF FF FF
Because expressions can be fairly complicated, the solution should probably be all-encompassing, most likely involving enforcing larger sizes on instructions that fall into this loop.