summaryrefslogtreecommitdiffstats
path: root/openpgp/src/parse
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src/parse')
-rw-r--r--openpgp/src/parse/partial_body.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/openpgp/src/parse/partial_body.rs b/openpgp/src/parse/partial_body.rs
index 1bd4e863..4f72c5d2 100644
--- a/openpgp/src/parse/partial_body.rs
+++ b/openpgp/src/parse/partial_body.rs
@@ -95,6 +95,12 @@ impl<T: BufferedReader<Cookie>> BufferedReaderPartialBodyFilter<T> {
amount, self.partial_body_length, self.last);
}
+ if self.last && self.partial_body_length == 0 {
+ // We reached the end. Avoid fruitlessly copying data
+ // over and over again trying to buffer more data.
+ return Ok(());
+ }
+
// We want to avoid double buffering as much as possible.
// Thus, we only buffer as much as needed.
let mut buffer = self.unused_buffers.pop()