rz_analysis_mask() called memset() with an unclamped oplen when an
instruction's decoded length extended past the remaining bytes in
the mask window, writing up to (oplen - nopcode) bytes past the end
of the size-byte heap allocation.
Clamp the memset length to the bytes actually available in the
buffer (avail = size - idx) before computing safe_oplen, and only
memset when nopcode fits within that clamped length.
Reproduced and verified with the h8300 arch/analysis plugin, where a
jsr instruction decodes to 4 bytes with only 2 bytes remaining in a
256-byte mask window, causing a 2-3 byte out-of-bounds heap write
(CWE-787). Confirmed via glibc _FORTIFY_SOURCE abort on direct
reproduction and via AddressSanitizer heap-buffer-overflow report.
Fixes#6795
- Refactor rz_core_analysis_resolve_golang_strings to maintain persistent dynamically resized basic block and string buffers, eliminating per-block malloc/free churn
- Unify multi-instruction signature matching across all 8 architectures with fast bitmask pre-filtering before decode callbacks
- Implement table-driven GoSignatureTable dispatch and const-qualify GoAsmPattern and GoSignature definitions
- Reuse basic block instruction offsets (block->ninstr) to avoid redundant instruction disassembly during string recovery
- Guard rz_io_nread_at against errors and short reads, and reject invalid candidate addresses in decode callbacks
- Define golang (ABIInternal) and golang_abi0 calling conventions in SDB for x86-64, ARM64, and x86-32
- Implement statistical prologue voting heuristic across sampled Go functions to automatically distinguish ABIInternal from ABI0 on stripped/obfuscated binaries
- Automatically assign detected Go calling convention to recovered sym.go.* functions
- Filter compiler-generated wrapper symbols (.abi0, .abiinternal, ..inittask, type:*) from deep function analysis
- Linked to rz-ghidra PR for SLEIGH decompiler prototype integration
* Run http test on Windows
* Install `psutil` whenever `requests` is installed
* Use `psutil` 6.1.1 on CentOS 7
* Install `python3-devel` on CentOS 7
* Install `py3-psutil` on Alpine
* Use `Python314-x64` in `clang_cl_64_dyn` build