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

Reading invalid GZ file causes infinite loop iteration #157

Closed
mikemiles-dev opened this issue Jun 1, 2018 · 0 comments
Closed

Reading invalid GZ file causes infinite loop iteration #157

mikemiles-dev opened this issue Jun 1, 2018 · 0 comments

Comments

@mikemiles-dev
Copy link

Please refer to this discussion: https://users.rust-lang.org/t/flate2-bufreader-issue-possible-infinite-loop-bug/17804/13

Code to reproduce:


extern crate flate2;

use std::io::{BufRead, BufReader};
use std::path::PathBuf;
use std::fs::OpenOptions;
use flate2::read::GzDecoder;

fn main() {
	let path = PathBuf::from("./empty.gz");

    let file = OpenOptions::new()
        .read(true)
        .open(&path).unwrap();
    let cbjson = GzDecoder::new(file);

    let reader = BufReader::new(cbjson);

    let stream = reader.lines().enumerate().map(move |(i,line)| {
        println!("LINE {} {:?}", i, line);
    });

    for result in stream { }
}
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

1 participant