mirror of
https://github.com/mandiant/capa.git
synced 2026-06-12 19:11:32 -07:00
5d43fc8fe3
`extract_insn_offset_features` in the x86/x64 BinExport2 extractor handled zero-offset patterns (e.g. `mov [reg], reg`) in a nested branch but was missing a `return` after yielding `Offset(0)` and `OperandOffset(0)`. Execution then fell through to the general `mask_immediate` path, which read `immediate` from the last-matched expression node (a register, not an integer). Since that field defaults to 0, the function emitted duplicate `Offset(0)` and `OperandOffset(0)` features for every such instruction. Fix: add `return` after the two yields in the zero-pattern branch. Tests: add `FEATURE_COUNT_TESTS_BE2_INTEL` covering `MOV [EDI], CX` at 0x401125 in mimikatz, asserting each of `Offset(0)` and `OperandOffset(1,0)` is emitted exactly once.