-
Notifications
You must be signed in to change notification settings - Fork 5
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
Critical: async_bufreader::BufReader::poll_fill_buf: Destroys data. #10
Comments
nom-bufreader/src/async_bufreader.rs Line 174 in c2e48f5
|
"AND", you can't use |
diff --git a/src/async_bufreader.rs b/src/async_bufreader.rs
index bb5557c..836c6fa 100644
--- a/src/async_bufreader.rs
+++ b/src/async_bufreader.rs
@@ -171,9 +171,16 @@ impl<R: AsyncRead> AsyncBufRead for BufReader<R> {
}
}
- let read = ready!(this.inner.poll_read(cx, this.buffer))?;
- *this.cap += read;
-
+ match this.inner.poll_read(cx, &mut this.buffer[*this.cap..]) {
+ Poll::Pending => {
+ /* This is supposed to let the compiler know pos can never be greater than cap... or something */
+ if *this.pos < *this.cap {
+ } else {
+ return Poll::Pending;
+ }
+ }
+ Poll::Ready(read) => *this.cap += read?,
+ }
Poll::Ready(Ok(&this.buffer[*this.pos..*this.cap]))
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 174
s/this.buffer/this.buffer[*this.cap..]/
.The text was updated successfully, but these errors were encountered: