You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
regex: assert state_lock-held at the prim call sites
src/regex/re.c uses file-static globals (re_flags and re_g_state)
to hold per-match flag state and capture spans. Every current
caller -- prim_re_find, prim_re_matches, prim_split's regex arm,
prim_str_replace's regex arm -- runs inside mino_call, which
holds state_lock, so the globals are effectively serialized. The
contract was not enforced anywhere, so a future refactor that
elides state_lock around any of those prims would silently
corrupt the next match's capture spans.
Add MINO_ASSERT_STATE_SAFE(S) at each prim's regex call site so
a missing lock fires a debug-build assert at the offending site
rather than leaking into a torn re_g_state. No restructure of
the regex module itself (which would otherwise have meant adding
a context parameter and reflowing every internal helper).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments