summary refs log tree commit diff
path: root/crypto/bzip2
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-07-15 23:36:16 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-07-15 23:36:16 +0700
commit7edbca353a0ba900c7f942797d72ca6b115d103a (patch)
treec23673424f03f1fe479c865ee7db4fd58b561348 /crypto/bzip2
parentAvoid redundant CheckUsageInRole calls (diff)
downloadBouncyCastle.NET-ed25519-7edbca353a0ba900c7f942797d72ca6b115d103a.tar.xz
Fix bzip2 compression for empty contents
- see https://github.com/bcgit/bc-java/issues/993
Diffstat (limited to 'crypto/bzip2')
-rw-r--r--crypto/bzip2/src/CBZip2OutputStream.cs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/bzip2/src/CBZip2OutputStream.cs b/crypto/bzip2/src/CBZip2OutputStream.cs
index ffac073fb..6e9d86bba 100644
--- a/crypto/bzip2/src/CBZip2OutputStream.cs
+++ b/crypto/bzip2/src/CBZip2OutputStream.cs
@@ -423,7 +423,10 @@ namespace Org.BouncyCastle.Apache.Bzip2
                 WriteRun();
             }
             currentChar = -1;
-            EndBlock();
+            if (last >= 0)
+            {
+                EndBlock();
+            }
             EndCompression();
             finished = true;
             Flush();