Runtime FFI code should be audited for cases where a With aggregate value is cast directly to a C pointer type instead of extracting the field that the foreign API expects.
Issue #340 was caused by exactly this pattern in rt/regex_runtime.w: text as *const u8 passed the address/representation of a With str value to PCRE2 rather than the string data pointer. The fix was to extract the data pointer explicitly with regex_str_data(text).
Scope for this follow-up:
- Search runtime and compiler-owned FFI bridge code for casts from aggregate/value types directly to raw C pointers.
- Treat
str, slices, arrays, structs, and runtime wrapper types as suspicious unless the code is intentionally passing the aggregate storage.
- Verify each C/foreign API boundary receives the representation it declares: data pointer, struct pointer, array pointer, or owned C string.
- Add helper functions where repeated representation extraction is needed, instead of ad hoc casts.
- Add focused behavior tests for any corrected bridge path.
Known fixed instance:
rt/regex_runtime.w PCRE2 subject pointer extraction fixed by 2d8bfe01.
This is not a release blocker for v0.15.1 unless a concrete failing bridge is found. It is a correctness audit to prevent recurrence of the #340 bug class.
Runtime FFI code should be audited for cases where a With aggregate value is cast directly to a C pointer type instead of extracting the field that the foreign API expects.
Issue #340 was caused by exactly this pattern in
rt/regex_runtime.w:text as *const u8passed the address/representation of a Withstrvalue to PCRE2 rather than the string data pointer. The fix was to extract the data pointer explicitly withregex_str_data(text).Scope for this follow-up:
str, slices, arrays, structs, and runtime wrapper types as suspicious unless the code is intentionally passing the aggregate storage.Known fixed instance:
rt/regex_runtime.wPCRE2 subject pointer extraction fixed by2d8bfe01.This is not a release blocker for v0.15.1 unless a concrete failing bridge is found. It is a correctness audit to prevent recurrence of the #340 bug class.