motelctl: termtext.JSON sizes its buffer by the body's length, with no sum (code scanning alert 64) #549
All Vouch review confidence checks passed
Residual risk 0.31 = Change Risk (0.42) × (1 − Review Confidence (0.26)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 323 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 34% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.346
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #549"
general
weight: 0.35
copilot-pull-request-reviewer[bot]
What.
termtext.JSONsizes its buffer by the body's length, with no sum, which clears code-scanning alert 64 (go/allocation-size-overflow) on #538. Intoclient-app.Why. CodeQL flagged
out := make([]byte, 0, len(b)+16)inmotelctl/internal/termtext/text.go: an addition on the length of whatio.ReadAllreturned, used as an allocation size. The sum cannot overflow: the client reads at mostmaxBody(4 MiB) plus one byte of an answer, and refuses anything over. The16was only a capacity hint. But the alert stood on a pull request the owner reads in full.The change. One line: the capacity is
len(b), andappendgrows the slice when escapes make the output longer. Every write to the buffer goes throughappendorfmt.Appendf, nothing reads its capacity, andwithNewlinecopies whatever the capacity, so what--jsonwrites is byte for byte the same.The builder read the rule's source against every allocation #538 adds in the non-test Go of
motelctl/,liveswap/andbox/(14makecalls): this was the only one with arithmetic in its size. CodeQL was not run here; that is a reading of the rule.Tests. No test can fail for an overflow that cannot occur, so none was added.
TestJSONand the--jsontests pass unchanged.go test -race ./...inmotelctl;make lint MODULES="motelctl"0 issues for both tag sets;make tidy-check; a full-history secret scan of the branch from a plain clone.Triage (the triage skill, loaded).
| Finding | S | O | D | Product | Size | Risk | Outcome |
|---|---|---|---|---|---|---|---|
| Code scanning: the buffer's size is a sum that "may overflow" | 1 | 1 | 1 | 1 | 1 | 1 | fix: severity 1 never clears by its product, and nothing wrong can be produced; fixed because the fix is one expression that changes no output (rule 3's cheap fix) |
Self-review, one round (an Opus reviewer that did not write it, given the diff and the bar): no finding. It confirmed no caller relies on spare capacity or on the result not aliasing the input, and that no other
makeinmotelctl's non-test Go has arithmetic in its size. No second round: nothing to fix.Flags for the person who merges. Not one-way. Not wide.
The bar for a review. A finding is welcome if it shows a byte of
--jsonoutput that changes, a write to the buffer that could now index out of range, or another line the same rule flags. Suggestions that name no failure are weighed as features; comments on wording are welcome but are not scored.🤖 Generated with Claude Code