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

BufferedInputStreamWrapper::tryRead fails on EOF #1980

Open
alexrobomind opened this issue Apr 8, 2024 · 1 comment
Open

BufferedInputStreamWrapper::tryRead fails on EOF #1980

alexrobomind opened this issue Apr 8, 2024 · 1 comment

Comments

@alexrobomind
Copy link
Contributor

Currently, the implementation of BufferedInputStreamWrapper::tryRead will throw on premature EOF due to forwarding to InputStream::read if the buffer is insufficient to fill the request:

size_t n = inner.read(buffer.begin(), minBytes, buffer.size());

return fromFirstBuffer + inner.read(dst, minBytes, maxBytes);

Wouldn't it make more sense to forward the read requests to InputStream::tryRead instead?

@kentonv
Copy link
Member

kentonv commented Apr 15, 2024

Looks like this bug was introduced in 227a491 when tryRead() was introduced and this implementation of read() was renamed to tryRead() without looking carefully enough at the details.

And that was 11 years ago, and no one ever noticed, I guess...

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

No branches or pull requests

2 participants