zyantific / zydis

Fast and lightweight x86/x86-64 disassembler and code generation library
https://zydis.re
MIT License
3.4k stars 434 forks source link

ZydisDisassemble (MSVC) generates 2 memset calls #445

Closed lordbendtner1337 closed 7 months ago

lordbendtner1337 commented 1 year ago

Currently the following code below will place a ZydisDisassembledInstruction on the stack, then memset it (and also memset ZydisDecodedInstruction info), then it will use a memcpy afterwards. This will cause 2 intrinsic memset calls to be placed into the code. *instruction = (ZydisDisassembledInstruction) { .runtime_address = runtime_address }; That will cause issues when using ZYAN_NO_LIBC.

Wouldn't it be better to just set the runtime_address; instruction->runtime_address = runtime_address;

Am I missing something? It's possible it's some compiler settings I'm using.

mappzor commented 1 year ago

See discussion in #430