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

Add a test for buffers that cannot hold complete values #56

Open
zslayton opened this issue Jun 5, 2020 · 0 comments
Open

Add a test for buffers that cannot hold complete values #56

zslayton opened this issue Jun 5, 2020 · 0 comments
Labels
S Small T-Shirt Size testing

Comments

@zslayton
Copy link
Contributor

zslayton commented Jun 5, 2020

We have a test that handles reading values across 'seam's in the default 4k buffer size. We should add a more specific/explicit test that uses a custom buffer size.

Under the covers we create a bufio.Reader with a default (4096-byte) internal buffer. After reading 4 bytes of BVM and 511 x 8 byte integer values, there are 4 bytes remaining in that buffer, plus another 4 in the underlying stream. Pre-fix, we’d do a partial read of those four bytes as a (corrupt) 512th integer, then try to read the remaining four bytes as another value.

(Might be worth trying to add a more specific test with a custom Reader so it’s more obvious what’s going on, if the bufio.Reader doesn’t get in the way? This is the code I wrote to debug the issue and figured I might as well include :))

Originally posted by @fernomac in ca20906

@therapon therapon added S Small T-Shirt Size testing labels Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S Small T-Shirt Size testing
Projects
None yet
Development

No branches or pull requests

2 participants