0

I'm playing with RE and I see a returning pattern: sometimes a label ends with some garbage after ret. It seems to satisfy nothing, as it encodes nothing, and yet, it exists along all the binaries.

                         LAB_014f16fb                                    XREF[2]:     014f1721(j), 014f1758(j)  
    014f16fb 48 83 c4 08     ADD        RSP,0x8
    014f16ff 44 89 e0        MOV        EAX,R12D
    014f1702 5b              POP        RBX
    014f1703 41 5c           POP        R12
    014f1705 41 5d           POP        R13
    014f1707 41 5e           POP        R14
    014f1709 41 5f           POP        R15
    014f170b 5d              POP        RBP
    014f170c c3              RET
    014f170d 0f              ??         0Fh
    014f170e 1f              ??         1Fh
    014f170f 00              ??         00h

I'm talking about the "??", which seems to encode nothing, and it actually appears after the RET, which means that practically, it is never run. As it is not label-assigned, it seems no instruction jumps to it. So why the compiler writes that?

  • To align the next function or branch target. Notice that the byte after that padding will have address `...0`, 16-byte aligned. – Peter Cordes Jun 26 '21 at 15:49

0 Answers0