Uh oh!
There was an error while loading. Please reload this page.
fix(summary): bound SummaryParser.buf on newline-less log floods (D3) - #227
Merged
Conversation
…226) SummaryParser.Feed accumulated bytes into p.buf until a '\n'. The display path caps an oversized tqdm line via displayLineMax (16 MB) in streamDisplayAndParse and drains the rest, but the drained bytes still flow through the TeeReader into Feed — so an ingestor emitting many MB of '\r'-redraws with no '\n' for the life of a (up to 1h) run grew p.buf without the display-side cap ever applying to the parser. Bound buf at parserLineMax (= displayLineMax; same package, referenced directly so the two paths can't drift). When the partial newline-less line passes the ceiling, drop it and enter drop-until-newline mode so the oversized line's tail is discarded too rather than parsed as a spurious fresh line; FlushLine honors the same state at EOF. A real banner line is tens of bytes, so newline-less content past 16 MB can never be one — dropping is safe and the parser still recovers to parse the closing banner once a '\n' finally lands. Adds a white-box test feeding a >2x-parserLineMax newline-less flood, asserting buf stays bounded and a real banner after the flood parses. Deferred finding D3 from the v0.8.0 review (#220). Low severity. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
LukasWodka
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes#226. Deferred finding D3 from the v0.8.0 review (#220). Low severity.
The bug
SummaryParser.Feedaccumulates bytes intop.bufuntil it sees a\n. The display path caps an oversized tqdm line viadisplayLineMax(16 MB) instreamDisplayAndParseand drains the rest — but the drained bytes still flow through theTeeReaderintoFeed. So a pathological ingestor emitting many MB of\r-redraws with no\nfor the life of a (up to 1hJobWatchTimeout) run growsp.bufwithout the display-side cap ever applying to the parser.The fix
Bound
bufatparserLineMax, defined as= displayLineMax— samesubmitpackage, referenced directly so the two paths can't drift. When the partial newline-less line passes the ceiling, drop it and enter a drop-until-newline state (droppingLine) so the oversized line's tail is discarded too rather than parsed as a spurious fresh line.FlushLinehonors the same state at EOF.A real banner line is tens of bytes, so newline-less content past 16 MB can never be one — dropping is safe, and the parser still recovers to parse the closing banner once a
\nfinally lands.buf's persistent size is now bounded byparserLineMax(peak isparserLineMax+ oneFeedchunk, transient).Test
TestSummaryParser_BufferBoundedOnNewlinelessFloodfeeds a >2×parserLineMaxnewline-less flood in bounded chunks, assertsbufnever exceedsparserLineMax, then feeds a terminating\n+ a real banner and asserts it still parses.go test ./internal/submit/,go vet,gofmtall clean.🤖 Generated with Claude Code
Note
Low Risk
Defensive bounds on log parsing only; legitimate banners are tiny and recovery after a terminating newline is covered by tests.
Overview
Caps
SummaryParsermemory when ingest logs never emit a newline — e.g. long tqdm\rredraws that the display path already drains but still pass through theTeeReaderintoFeed.parserLineMaxis set todisplayLineMax(16 MB) so parser and display limits stay aligned. Once a partial line exceeds that,Feedresets the buffer and setsdroppingLineuntil the next\n, so the rest of the junk line is skipped instead of being parsed as a new line.FlushLineapplies the same rule at EOF so a truncated tail is not fed tofeedLine.Adds
TestSummaryParser_BufferBoundedOnNewlinelessFlood: multi-chunk newline-less flood keepsbuf≤parserLineMax, then\n+ a real banner still parses correctly.Reviewed by Cursor Bugbot for commit 2c92d92. Bugbot is set up for automated code reviews on this repo. Configure here.