Repository navigation
Commit 5a9f22f
committed
fix(pool): POOL005 is a VIEW over-read only — drop Array.Clear, require zero start
Review feedback on #72 (Codex + CodeRabbit), all precision tightening on an
already-green PR:
1. Codex: do not flag Array.Clear(buf, 0, buf.Length). It is a WRITE/wipe — it only
zeros the pooled tail (a safe clear-before-Return idiom) and exposes nothing; the
over-read bug is READING/COPYING the tail through a view. Removed ArrayClearOverOwner
entirely; EmitOverspans now flags only read-capable VIEWS (FullViewOwner). Renamed
the corpus case arraypool-clear-past-length -> arraypool-length-overread and made it
the `.Length` VIEW over-read (buf.AsSpan(0, buf.Length)); after.cs bounds by n.
2. CodeRabbit: the `.Length` view match now also requires the START/index to be the
constant 0 (IsZeroInt via the SemanticModel) — buf.AsSpan(k, buf.Length) for k != 0
is out of range, not this pattern. Applies to AsSpan/AsMemory(0, buf.Length) and
new Span<T>(buf, 0, buf.Length).
3. CodeRabbit (spec nitpick): B9 now notes the oversize principle covers MemoryPool too
(IMemoryOwner.Memory wraps an oversized backing via .Memory.Length), and that a
write/wipe is not flagged.
NOT changed: --min-recall stays 16. CodeRabbit flagged it as "impossible (corpus is 14)"
but that miscounts — the benchmark scores corpus/real-world (14) AND corpus/wpf (4) = 18
total, and --min-recall is the CAUGHT floor, not the corpus size. #72's benchmark is
green at 16 (16 caught of 18); the `.Length` VIEW form still catches arraypool-length-
overread after dropping Array.Clear. spec/P-007/ci.yml comments updated to match.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg8kSk1YT14x7A1vo5zgED1 parent b3bf5b1 commit 5a9f22f
13 files changed
Lines changed: 141 additions & 150 deletions
File tree
- .github/workflows
- corpus/real-world
- arraypool-clear-past-length
- arraypool-length-overread
- docs/proposals
- frontend/roslyn/OwnSharp.Extractor
- spec
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
792 | | - | |
793 | | - | |
794 | | - | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
795 | 796 | | |
796 | 797 | | |
797 | 798 | | |
| |||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments