mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
4617263030
The MATCHERR optimization replaced JMPNOT (BS, 4 bytes) with MATCHERR (B, 2 bytes) and rewound s->pc by 2. When pattern alternation (e.g. a|B) dispatched a success jump to s->pc before the optimization, the rewind shifted subsequent instructions and the jump landed in the middle of the next instruction, causing out-of-bounds access at runtime. Replace JMPNOT in-place with MATCHERR+NOP+NOP to keep the same 4-byte size, so s->pc does not change and jump targets stay valid. Co-authored-by: Claude <noreply@anthropic.com>