cs_disasm_iter: return early on zero-size input (#2886) (#2920)

Prevent calling backend decoder with no remaining bytes,
which could lead to out-of-bounds reads.

Co-authored-by: Petar Andrić <[email protected]>
This commit is contained in:
Rot127
2026-05-14 10:23:59 +00:00
committed by GitHub
co-authored by Petar Andrić
parent 30d610cd65
commit 2de76ae94d
+3
View File
@@ -1114,6 +1114,9 @@ CAPSTONE_EXPORT
bool CAPSTONE_API cs_disasm_iter(csh ud, const uint8_t **code, size_t *size,
uint64_t *address, cs_insn *insn)
{
if (*size == 0)
return false;
struct cs_struct *handle;
uint16_t insn_size;
MCInst mci;