From 8773152a57a4e1524be66c7d6777c48de246040f Mon Sep 17 00:00:00 2001 From: ljfa Date: Mon, 21 Sep 2015 18:10:03 +0200 Subject: Make the inflate_streambuf rewind the input --- src/io/izlibstream.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/io/izlibstream.cpp b/src/io/izlibstream.cpp index 85e04a189a..0a7512469e 100644 --- a/src/io/izlibstream.cpp +++ b/src/io/izlibstream.cpp @@ -78,7 +78,13 @@ inflate_streambuf::int_type inflate_streambuf::underflow() throw std::bad_alloc(); case Z_STREAM_END: - stream_end = true; + if(!stream_end) + { + stream_end = true; + //In case we consumed too much, we have to rewind the input stream + is.clear(); + is.seekg(-static_cast(zstr.avail_in), std::ios_base::cur); + } if(have == 0) return traits_type::eof(); break; -- cgit 0.0.5-2-1-g0f52