Skip to content

fix: return EOF when buffer is empty - #476

Merged
bodgit merged 3 commits into
mainfrom
bra-eof
Jul 10, 2026
Merged

fix: return EOF when buffer is empty#476
bodgit merged 3 commits into
mainfrom
bra-eof

Conversation

@bodgit

@bodgit bodgit commented Jul 10, 2026

Copy link
Copy Markdown
Owner
  • fix: return EOF when buffer is empty
  • test: add test case for read loop
  • test: Tweak test case

secDre4mer and others added 3 commits July 11, 2026 00:21
The bra reader could return invalid results when a read ended
exactly so no data was left: In this case, the rc.rc read returned
(0, EOF), rc.n was 0. Therefore the rc.buf.Read() was called with
an empty slice, which caused it to return (0, nil), which was
then returned to the caller, and left the reader in the same
state as before.
In combination with e.g. io.ReadAll, this could cause an endless
loop.
* Rename the test and example archive to make it slightly more obvious
  which filter is tested and tie it to the GitHub PR number.
* Wrap the test with a timeout so without the fix the test times out
  quickly rather than just spinning until the overall test timeout triggers.
@bodgit bodgit changed the title bra eof fix: return EOF when buffer is empty Jul 10, 2026
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 75.362% (+0.2%) from 75.131% — bra-eof into main

@bodgit
bodgit merged commit b9f4edb into main Jul 10, 2026
7 of 8 checks passed
@bodgit
bodgit deleted the bra-eof branch July 10, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants