Skip to content

Infinite loop caused by invalid UTF-8 bytes #2784

@newca12

Description

@newca12
Contributor

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;
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ioArea: futures::iobug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @newca12@taiki-e

      Issue actions

        Infinite loop caused by invalid UTF-8 bytes · Issue #2784 · rust-lang/futures-rs