Repository navigation
Commit 735d59f
committed
fix(extractor): a pooled buffer passed to an escaping constructor is an ownership transfer, not a leak (mined FP)
Second false positive from mining Pipelines.Sockets.Unofficial:
ArrayPoolBufferWriter.CreateNewSegment does `var array = pool.Rent(size); return
new ArrayPoolRefCountedSegment(pool, array, prev);`. The flow-locals escape
analysis treats a pooled buffer passed as an argument as a BORROW (so
`pool.Return(buf); Work(buf)` still trips use-after-return) and expects a
same-method Return — missing that the buffer's ownership is TRANSFERRED to the
constructed object (which Returns it on its own teardown) and leaves the method
inside that returned object. Result: a false OWN001 "never disposed/returned".
New PassedToEscapingCtor: a pooled buffer handed to a `new` whose result is the
direct return value or a field-assignment RHS escapes (untracked), like a returned
local. One level only — a `new` buried in a local or another expression stays a
borrow (an honest limitation). Purely syntactic, so it holds for unresolved wrapper
types. Only the --flow-locals path is affected (the syntactic D1 path already
escapes all arg-passed locals); a plain borrow `Work(buf)` still leaks if unreturned.
Regression guard: FlowLocalsSample.PooledIntoReturnedCtor (`ctorMoved` handed to a
returned PooledHolder) added to the --flow-locals job's must-stay-silent list. No
corpus case has this shape, so the recall floor is unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg8kSk1YT14x7A1vo5zgED1 parent 70376da commit 735d59f
3 files changed
Lines changed: 48 additions & 2 deletions
File tree
- .github/workflows
- frontend/roslyn
- OwnSharp.Extractor
- samples
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
510 | 510 | | |
511 | 511 | | |
512 | 512 | | |
513 | | - | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
514 | 517 | | |
515 | 518 | | |
516 | 519 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1037 | 1037 | | |
1038 | 1038 | | |
1039 | 1039 | | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
1040 | 1053 | | |
1041 | 1054 | | |
1042 | 1055 | | |
| |||
2394 | 2407 | | |
2395 | 2408 | | |
2396 | 2409 | | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
2397 | 2417 | | |
2398 | | - | |
| 2418 | + | |
| 2419 | + | |
2399 | 2420 | | |
2400 | 2421 | | |
2401 | 2422 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
504 | 505 | | |
505 | 506 | | |
506 | 507 | | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
507 | 529 | | |
508 | 530 | | |
509 | 531 | | |
| |||
0 commit comments