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

Infinite loop caused by invalid UTF-8 bytes #2784

Closed
newca12 opened this issue Oct 24, 2023 · 0 comments · Fixed by #2785
Closed

Infinite loop caused by invalid UTF-8 bytes #2784

newca12 opened this issue Oct 24, 2023 · 0 comments · Fixed by #2785
Labels
A-io Area: futures::io bug

Comments

@newca12
Copy link
Contributor

newca12 commented Oct 24, 2023

This is easyly reproducible on the master branch and also on the 0.3 branch

use futures::{io::BufReader, StreamExt};
use futures::AsyncBufReadExt;

#[tokio::main]
async fn main() {
    let bytes: [u8; 44] = [
        0x70, 0x69, 0x65, 0x72, 0x72, 0x65, 0x0a, 0x70, 0x61, 0x75, 0x6c, 0x0a, 0x76, 0x69, 0x6e,
        0x63, 0x65, 0x6e, 0x74, 0x0a, 0x61, 0x75, 0x72, 0xe9, 0x6c, 0x69, 0x65, 0x0a, 0x6f, 0x6c,
        0x69, 0x76, 0x69, 0x65, 0x72, 0x0a, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x72, 0x64, 0x0a,
    ];
    let stream = BufReader::new(bytes.as_slice()).lines();
    let stream = stream.map(|_f| {
        //dbg!(_f);
        ()
    });
    stream.collect::<()>().await;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-io Area: futures::io bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants