-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix snippet buffered read logic #8560
Conversation
Tagging subscribers to this area: @dotnet/area-system-io Issue DetailsThe snippet generates a file with 215 bytes. Fix buffered reading to be technically correct and work for arbitrary file contents. Fixes #4141
|
The snippet generates a file with 215 bytes. It reads the file with a 1024 byte buffer. While this works with a new 0-initialized buffer, the buffered reading misses using the returned read bytes count. A file with > 1024 bytes will reuse the now non-0 buffer and print unintended values. Fix buffered reading to be technically correct and work for arbitrary file contents. Fixes dotnet#4141
Learn Build status updates of commit b017ccc: ✅ Validation status: passed
For more details, please refer to the build report. Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report. For any questions, please:
|
Learn Build status updates of commit b054d8c: ✅ Validation status: passed
For more details, please refer to the build report. Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report. For any questions, please:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @Kissaki !
The CI leg is red due to missing solution file. I've verified manually that the provided code builds fine:
|
The snippet generates a file with 215 bytes.
It reads the file with a 1024 byte buffer.
While this works with a new 0-initialized buffer, the buffered reading misses using the returned read bytes count.
A file with > 1024 bytes will reuse the now non-0 buffer and print unintended values.
Fix buffered reading to be technically correct and work for arbitrary file contents.
Fixes #4141