summaryrefslogtreecommitdiffstats
path: root/openpgp/src/parse
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src/parse')
-rw-r--r--openpgp/src/parse/parse.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/openpgp/src/parse/parse.rs b/openpgp/src/parse/parse.rs
index 3722f79b..90f7264f 100644
--- a/openpgp/src/parse/parse.rs
+++ b/openpgp/src/parse/parse.rs
@@ -337,7 +337,10 @@ impl<'a> PacketHeaderParser<'a> {
self.error(Error::MalformedPacket(reason.into()).into())
}
- fn error(self, error: failure::Error) -> Result<PacketParser<'a>> {
+ fn error(mut self, error: failure::Error) -> Result<PacketParser<'a>> {
+ // Rewind the dup reader, so that the caller has a chance to
+ // buffer the whole body of the unknown packet.
+ self.reader.rewind();
Unknown::parse(self, error)
}