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
{{ message }}
Repository navigation
Commit 46a7f30
Browse filesBrowse the repository at this point in the historyBrowse files
feat(extractor): borrow checker — pooled-buffer Span view used after Return → OWN002 (POOL002) (#69)
The borrow checker's first bite on real C# (B4 / P-007 POOL002) — lifetime/aliasing analysis,
the lever the flat "disposed anywhere?" scanners don't reach.
The flat pass and the existing pool flow only caught a use-after-return when the BUFFER LOCAL
ITSELF was referenced after Return. When the read goes through a stored Span view —
`Span<byte> view = buf.AsSpan(0,n); pool.Return(buf); view[0] = 42;` — the buffer name never
appears at the use site, so it looked released-and-untouched: a miss (and a nasty silent aliasing
bug, since the array is recycled to another caller).
A Span/ReadOnlySpan view of a tracked buffer is now modelled as a BORROW: a reference to the view
local lowers to a use of the OWNER (ViewOwnerOf resolves the view through its declaration's
initializer). The borrow is recognised by the RESOLVED BCL symbols — System.MemoryExtensions.AsSpan
and the System.Span<T>/ReadOnlySpan<T> constructor (via IsInNamespace), not by name, so a project's
own AsSpan / a look-alike Span type is not mistaken for a borrow (Codex). A use after Return then
trips OWN002.
Purely extractor-side: the core needs no borrow concept; it sees a plain use-after-release (facts
identical to arraypool-use-after-return). A ref-struct Span cannot escape the method, which is what
makes "use of the view = use of the owner, here" sound. Conservative (0 FP): a view of an
untracked/escaped buffer, or one used before the Return, adds no finding.
Pinned by corpus `arraypool-span-view-after-return` (before → OWN002, after silent), lifting the
benchmark recall floor 11 → 12. First slice: Span/ReadOnlySpan via AsSpan() / new Span<T>; Memory<T>
(escapable) and view reassignment left for later. ruff + mypy --strict clean, corpus 10/10,
ownir 116/116; both extractor + both dog-food jobs green (no new FP).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg8kSk1YT14x7A1vo5zgED
0 commit comments