diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-05-13 12:08:22 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-05-13 14:47:51 +0200 |
commit | 34687bd6dd750edaadfc76ba0bbe28dd401dd655 (patch) | |
tree | 7cf2c30c2aca0f914971c6bdcc3fb3bb20c1c462 | |
parent | 7e3366ee8b0cb45d63af78cee7186c85e487e917 (diff) |
openpgp: Fix worst-case estimate of compressed data size.
- For short messages where the signature size dominates, compression
algorithms may inflate the message size considerably.
-rw-r--r-- | openpgp/src/serialize/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/openpgp/src/serialize/mod.rs b/openpgp/src/serialize/mod.rs index 9d16e8ed..eeda5c43 100644 --- a/openpgp/src/serialize/mod.rs +++ b/openpgp/src/serialize/mod.rs @@ -1660,7 +1660,7 @@ impl NetLength for CompressedData { + self.common.body.as_ref().map(|body| body.len()).unwrap_or(0); // Worst case, the data gets larger. Account for that. - let inner_length = inner_length + cmp::max(inner_length / 10, 32); + let inner_length = inner_length + cmp::max(inner_length / 2, 128); 1 // Algorithm. + inner_length // Compressed data. |