diff options
author | Neal H. Walfield <neal@pep.foundation> | 2017-12-11 22:25:52 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2017-12-11 22:27:57 +0100 |
commit | 21bfc0fba28916aa7f0af7b0237158b766ab53b9 (patch) | |
tree | a960670c20a7069600c1e17951b5821375072f2e /src | |
parent | 221de50d96f311a8a5687307c1c1a2fd89406081 (diff) |
Don't forget to wrap the reader when creating a container.
- Our convention is that a container wraps the provided reader.
Also do this when dealing with a compressed packet that is
uncompressed.
Diffstat (limited to 'src')
-rw-r--r-- | src/openpgp/parse/parse.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/openpgp/parse/parse.rs b/src/openpgp/parse/parse.rs index 098e590e..9708cd00 100644 --- a/src/openpgp/parse/parse.rs +++ b/src/openpgp/parse/parse.rs @@ -395,8 +395,15 @@ fn compressed_data_parser<'a, R: BufferedReader + 'a>(mut bio: R) // 3 - BZip2 [BZ2] // 100 to 110 - Private/Experimental algorithm let bio : Box<BufferedReader> = match algo { - 0 => // Uncompressed. - Box::new(bio), + 0 => { + // Uncompressed. + bio.consume(1); + // Our ownership convention is that each container + // pushes exactly one `BufferedReader` on the reader + // stack. In this case, we need a pass-through + // filter. We can emulate this using a Limitor. + Box::new(BufferedReaderLimitor::new(bio, std::u64::MAX)) + }, 1 => // Zip. Box::new(BufferedReaderDeflate::new(bio)), 2 => // Zlib |