Fix #71: bound transcribe's subprocess output retention - #78
Merged
Conversation
All four transcribe subprocess sites buffered child output unbounded (CombinedOutput/Output, and the heartbeat's bytes.Buffer the engine sites now funnel through) while at most an 800-byte tail — or one JSON field — was ever consumed. record already closed this assumption twice, with written OOM rationale; transcribe is the one package handing attacker-authorable media to a media parser. Add a tailSink (8 KiB trailing window; stderrRetain's sizing) for the ffmpeg conversion and runWithHeartbeat, and a headSink (1 MiB leading window; probeSink's sizing) for ffprobe's -show_format stdout, where a truncated JSON lands on the same graceful no-derivation path as a missing tag. Both sinks honour the io.Writer full-count contract (probeSink.Write's lesson). Fixes #71. Assisted-by: Claude:claude-fable-5
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 free
to 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.
Validated against main, with one drift from the issue text: the two whisper sites'
CombinedOutputcalls have since been funnelled throughrunWithHeartbeat(#57), whosebytes.Bufferwas equally unbounded — so the fix lands there, plusconvertRunnerandderiveOffset.Fix:
tailSink(8 KiB trailing window,stderrRetain's sizing and rationale) for the combined-output sites;headSink(1 MiB leading window,probeSink's sizing) for ffprobe stdout, where truncation degrades to the same graceful(0, false)no-derivation path as a missing tag. Both honour the io.Writer full-count contract. Regression tests: a 300 KB chatter run through the heartbeat must retain ≤ 8 KiB ending with the child's last words; an oversized-show_formatdump must not yield an offset; sink retention/contract unit tests.go test -raceclean. CHANGELOG entry added.Fixes #71