Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse_lines: Fix partial reads from Linux /porc #4108

Merged
merged 1 commit into from
Mar 8, 2025

Conversation

hillu
Copy link
Contributor

@hillu hillu commented Mar 6, 2025

Byte order mark detection from utfbom would only read 4 bytes, breaking some reads from /proc, e.g. /proc/sys/kernel/tainted.

parse_lines operates with byte-encoded strings, so only the BOM codepoint's UTF-8 encoding should be interesting. Moving it into processing of individual lines, after the bufio.Scanner's buffer has been filled, ensures that it does not cause extra read operations.

Close #4106

Byte order mark detection from `utfbom` would only read 4 bytes,
breaking some reads from `/proc`, e.g. `/proc/sys/kernel/tainted`.

parse_lines operates with byte-encoded strings, so only the BOM
codepoint's UTF-8 encoding should be interesting. Moving it into
processing of individual lines, after the bufio.Scanner's buffer has
been filled, ensures that it does not cause extra read operations.

Close Velocidex#4106
@scudette scudette merged commit 4365156 into Velocidex:master Mar 8, 2025
3 checks passed
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.

Surprising parse_line behavior leads to partially-read lines from Linux /proc filesystem.
2 participants