No operand in the database uses ZYDIS_IMPLREG_TYPE_IP_ASZ, so the switch
case in ZydisDecodeOperandImplicitRegister is unreachable. Drop the type
and its handler; the IP_SSZ path keeps the existing EIP mapping.
Do a bare minimum to fix the build. Don't try to use cpuset API
and pthread_setaffinity_np() because they require super-user
privileges (or setting security.models.extensions.user_set_cpu_affinity).
Relevant link: https://man.netbsd.org/NetBSD-10.1/affinity.3
ZydisFormatterBufferGetToken unconditionally dereferences
`(ZydisFormatterTokenConst*)buffer->string.vector.data - 1`. When the
buffer was initialized for plain-string formatting (is_token_list ==
ZYAN_FALSE, as set up by ZydisFormatterBufferInit), no
ZydisFormatterToken header precedes the data pointer, so this read
goes two bytes before the user-provided output buffer.
Mirror the guard already present in ZydisFormatterBufferGetString and
return ZYAN_STATUS_INVALID_OPERATION up front when the buffer is not
a token list, so the function no longer reads (and reports back to
the caller a pointer into) memory outside the buffer.
On 32-bit targets, ZydisStringAppendDecU calls both the 64-bit and the
32-bit decimal append helpers when the input value has any of its upper
32 bits set, because the 32-bit fallback branch is missing the `else`
that the sibling ZydisStringAppendHexU has. This silently appends the
value twice (once correctly as a 64-bit decimal, once incorrectly as
the truncated low 32 bits) and consumes roughly twice the expected
buffer space, which can also turn into a spurious
ZYAN_STATUS_INSUFFICIENT_BUFFER_SIZE for callers that sized their
output buffer based on the documented decimal width.
Mirror the structure of ZydisStringAppendHexU by guarding the
ZydisStringAppendDecU32 fallback with `else` so exactly one of the
two helpers runs.
ZydisDecodeOperands writes operands[i].imm.value/.is_signed/.is_address/
.is_relative from instruction->raw.imm[imm_id], but populated .offset
and .size via the bare `instruction->raw.imm->offset` / `->size`, which
always indexes element 0. For any instruction with two immediates (e.g.
ENTER imm16, imm8) the second decoded operand inherits the offset and
size of the first immediate.
Index both fields by imm_id to match the rest of the assignment block.
Even if only a single byte is copied, that byte will not be at the
lowest address of a ZyanU64 value, so a cast to ZyanU8 is still
necessary, only without a byte swap.
* Bump version number to 5.0.0
Since we already introduced breaking API changes, so there should be
a way to detect those changes for users.
* Remove type cast in VERSION macros
Allows preprocesser #if statements to use version macros.
* ci: fix meson minimal build