Index: src/streams/gzipinputstream.cpp =================================================================== --- a/src/streams/gzipinputstream.cpp +++ b/src/streams/gzipinputstream.cpp 2011-10-08 09:55:16.982992324 -0300 @@ -29,6 +29,7 @@ GZipInputStream* const p; InputStream* input; z_stream_s zstream; + bool started; Private(GZipInputStream* gi, InputStream* input, ZipFormat format); ~Private(); @@ -41,7 +42,7 @@ :p(new Private(this, input, format)) { } GZipInputStream::Private::Private(GZipInputStream* gi, - InputStream* i, ZipFormat format) :p(gi), input(i) { + InputStream* i, ZipFormat format) :p(gi), input(i), started(false) { // initialize values that signal state p->m_status = Ok; @@ -73,6 +74,7 @@ r = inflateInit2(&zstream, -MAX_WBITS); break; } + started = true; if (r != Z_OK) { p->m_error = "Error initializing GZipInputStream."; dealloc(); @@ -94,7 +96,10 @@ } void GZipInputStream::Private::dealloc() { - inflateEnd(&zstream); + if (started) { + inflateEnd(&zstream); + started = false; + } input = NULL; } bool Index: src/streams/lzmainputstream.cpp =================================================================== --- a/src/streams/lzmainputstream.cpp +++ b/src/streams/lzmainputstream.cpp 2011-10-08 09:57:15.429992372 -0300 @@ -58,7 +58,7 @@ CLzmaProps props; SRes res = LzmaProps_Decode(&props, (const Byte*)data, LZMA_PROPS_SIZE); int64_t size = readLittleEndianInt64(data + LZMA_PROPS_SIZE); - return res == SZ_OK && props.dicSize <= 8388608 && (size == -1 || + return res == SZ_OK && props.dicSize <= 0x2000000 && (size == -1 || (props.dicSize < size && size < 1099511627776LL)); // only support < 1Tb } LZMAInputStream::LZMAInputStream(InputStream* input)