This chunk of code
|
*p++ = 0x68; |
|
*(INT32 *)p = arg; |
|
p += 4; |
|
|
|
// push arg2 |
|
*p++ = 0x68; |
|
*(INT32 *)p = arg2; |
|
p += 4; |
definitely have undefined behavior because there are misaligned INT32 memory writes. This issue may also occur in other places in this file.
Clang with
-fsanitize=undefined can catch this:
https://godbolt.org/z/EeEzvfWsj