Control: tags -1 + patch

Hi,

I checked how far 5.0.9-1 is affected, since the advisory only gives
commits on the "next" (6.x) branch.

- M68K: still affected. Upstream's v5 backport for this CVE (d452e062,
"Backports of CVE fixes", included in 5.0.9) added a bounds check to
M68K_insn_name() with an off-by-one:

if (id > ARR_SIZE(s_instruction_names))
return NULL;
return s_instruction_names[id];

So id == ARR_SIZE (M68K_INS_ENDING) still reads one entry past the
table. On "next" this was corrected later in

https://www.google.com/url?q=https://github.com/capstone-engine/capstone/commit/7441aee228&source=gmail&ust=1793770388975000&sa=E
"m68k: fix off-by-one bounds check in M68K_insn_name (#2964)"

- if (id > ARR_SIZE(s_instruction_names)) {
+ if (id >= ARR_SIZE(s_instruction_names)) {

The v5 branch HEAD still has '>', so the next 5.x release won't fix
this unless upstream backports it.

- RISCV: not affected in 5.0.9. RISCV_insn_name() checks
id >= RISCV_INS_ENDING, and insn_name_maps[] has exactly
RISCV_INS_ENDING (273) entries.

Test: capstone 5.0.9 source, static library built with
-fsanitize=address,undefined (archs m68k, riscv and wasm), and a small
program calling cs_insn_name() for IDs ENDING-2 .. ENDING+2. The advisory
says IDs outside the valid range should return NULL.

5.0.9 as released:
AddressSanitizer: global-buffer-overflow, READ of size 8
#0 M68K_insn_name arch/M68K/M68KInstPrinter.c:368
#1 cs_insn_name src/cs.c:1234
5.0.9 + 7441aee2:
m68k id=373 unlk, 374 unpk, 375 (ENDING) NULL, 376 NULL, 377 NULL
riscv id=271 xor, 272 xori, 273 (ENDING) NULL, 274 NULL, 275 NULL
No sanitizer reports.

The patch is the single line above; the commit's new unit test file
targets the 6.x tests/unit layout, which doesn't exist in 5.x.

(Separately, CVE-2026-49263 (#1144519, WASM br_table) is already fixed in
5.0.9 by the same backport. I'm sending that to the tracker list.)

Thanks!

Reply via email to