Skip to content

Reader: fill the buffer passed to Read#19

Merged
chrisnovakovic merged 1 commit intoplease-build:masterfrom
chrisnovakovic:reader-read-full-string-table
Oct 8, 2025
Merged

Reader: fill the buffer passed to Read#19
chrisnovakovic merged 1 commit intoplease-build:masterfrom
chrisnovakovic:reader-read-full-string-table

Conversation

@chrisnovakovic
Copy link

@chrisnovakovic chrisnovakovic commented Oct 8, 2025

bufio.Reader.Read(p) may read fewer than len(p) bytes from the underlying io.Reader into p. When it does, archive members appear artificially truncated; when this happens to the string table, it leads to red herring errors (e.g. missing entries, missing trailing newlines).

After capping len(p) to the remaining number of bytes to be read from the current member's data section, ensure that exactly len(p) bytes are read from the underlying io.Reader when reading the string table.

@chrisnovakovic chrisnovakovic marked this pull request as draft October 8, 2025 17:02
@chrisnovakovic chrisnovakovic force-pushed the reader-read-full-string-table branch from d6d665c to 9c95a99 Compare October 8, 2025 18:31
`bufio.Reader.Read(p)` may read fewer than `len(p)` bytes from the
underlying `io.Reader` into `p`. When it does, archive members appear
artificially truncated; when this happens to the string table, it leads
to red herring errors (e.g. missing entries, missing trailing newlines).

After capping `len(p)` to the remaining number of bytes to be read from
the current member's data section, ensure that exactly `len(p)` bytes
are read from the underlying `io.Reader` when reading the string table.
@chrisnovakovic chrisnovakovic force-pushed the reader-read-full-string-table branch from 9c95a99 to 2867264 Compare October 8, 2025 19:02
@chrisnovakovic chrisnovakovic marked this pull request as ready for review October 8, 2025 19:03
@chrisnovakovic chrisnovakovic changed the title Reader: read the entire string table into memory Reader: fill the buffer passed to Read Oct 8, 2025
@chrisnovakovic chrisnovakovic merged commit b347aa5 into please-build:master Oct 8, 2025
2 checks passed
@chrisnovakovic chrisnovakovic deleted the reader-read-full-string-table branch October 8, 2025 19:05
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.

2 participants