From 7edbca353a0ba900c7f942797d72ca6b115d103a Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 15 Jul 2021 23:36:16 +0700 Subject: Fix bzip2 compression for empty contents - see https://github.com/bcgit/bc-java/issues/993 --- crypto/bzip2/src/CBZip2OutputStream.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'crypto/bzip2/src') 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(); -- cgit 1.5.1