Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Stack Overflow for very simple code #57

Closed
andrew-pa opened this issue Jan 25, 2018 · 3 comments
Closed

Stack Overflow for very simple code #57

andrew-pa opened this issue Jan 25, 2018 · 3 comments

Comments

@andrew-pa
Copy link

This code runs but then panics with thread 'main' has overflowed its stack:

extern crate zip;

use zip::*;
use zip::write::*;
use std::io::Write;

fn main() {
    let mut out = ZipWriter::new(std::fs::File::create("out.zip").expect("create file"));
    out.start_file("test.txt", FileOptions::default());
    write!(out, "Hello, World!");
}

If you change it to use CompressionMethod::Stored instead, then it works just fine. Older versions before the feature-gated deflate compression seem to also work, as does bzip2 and running in Release mode. Perhaps the deflate code is too deep when unoptimized, with the new feature-gating tricking the compiler somehow? Perhaps that makes it a flate2 issue? I'm also on Windows

@mvdnes
Copy link
Collaborator

mvdnes commented Jan 27, 2018

The flate2 implementation has some very large structures, which are all placed on the stack currently.
In debug mode, the size of the initial stack is too small on Windows. Your example works fine in release mode.

I have submitted an issue as Frommi/miniz_oxide#21

@andrew-pa
Copy link
Author

Cool! Thank you!

@mvdnes
Copy link
Collaborator

mvdnes commented Jun 29, 2018

With miniz_oxide 0.1.3, this issue seems to be resolved.

@mvdnes mvdnes closed this as completed Jun 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants