{
  "WorkItem": {
    "AffectedComponent": {
      "Name": "",
      "DisplayName": ""
    },
    "ClosedComment": "not a bug",
    "ClosedDate": "2009-12-27T13:33:10.59-08:00",
    "CommentCount": 0,
    "Custom": null,
    "Description": "There is a do / while loop in the Read function.\n \nIt returns 0 in the second pass in the loop, because the following condition is true after _deflate:          if (nomoreinput && (rc == ZlibConstants.Z_BUF_ERROR))\n \n \nAs a result the funtion parameter buffer is correctly filled, however the number of bytes read is 0.\n \nThe resultcode (rc) equals ZLibConstants.Z_BUF_ERROR (-5)  How is this possible?\n \n \n \nTest code created in Test project as part of DotNetZip.\n \n \nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing Ionic.Zlib;\nusing System.IO;\n \nnamespace Test\n{\n    class Program\n    {\n        static void Main(string[] args)\n        {\n            byte[] AllBytes = System.IO.File.ReadAllBytes(@\"D:\\Temp\\x.txt\");\n            System.IO.MemoryStream MC = new System.IO.MemoryStream();\n            CCompress.Compress(new System.IO.MemoryStream(AllBytes), MC);\n \n            MC.Seek(0, System.IO.SeekOrigin.Begin);\n \n            System.IO.MemoryStream MD = new System.IO.MemoryStream();\n            CDecompress.Decompress(MC, MD);\n            MD.Seek(0, System.IO.SeekOrigin.Begin);\n \n        }\n    }\n \n    public class CCompress\n    {\n        public static void Compress(MemoryStream inStream, Stream outStream)\n        {\n            using (DeflateStream Compressor = new DeflateStream(outStream\n                , CompressionMode.Compress\n                , CompressionLevel.Default\n                , true))\n            {\n                inStream.Seek(0, SeekOrigin.Begin);\n                byte[] Buffer = new byte[1024];\n                int BytesRead = inStream.Read(Buffer, 0, Buffer.Length);\n                while (BytesRead != 0)\n                {\n                    Compressor.Write(Buffer, 0, BytesRead);\n                    BytesRead = inStream.Read(Buffer, 0, Buffer.Length);\n                }\n            }\n        }\n    }\n \n    public class CDecompress\n    {\n        public static void Decompress(Stream inStream, MemoryStream outStream)\n        {\n            using (DeflateStream Decompressor = new DeflateStream(inStream\n                , CompressionMode.Decompress\n                , CompressionLevel.Default\n                , true))\n            {\n                byte[] Buffer = new byte[1024];\n                int BytesRead = Decompressor.Read(Buffer, 0, Buffer.Length);\n                while (BytesRead != 0)\n                {\n                    outStream.Write(Buffer, 0, BytesRead);\n                    BytesRead = Decompressor.Read(Buffer, 0, Buffer.Length);\n                }\n            }\n        }\n    }\n}",
    "LastUpdatedDate": "2013-05-16T05:31:58.45-07:00",
    "PlannedForRelease": "",
    "ReleaseVisibleToPublic": false,
    "Priority": {
      "Name": "Low",
      "Severity": 50,
      "Id": 1
    },
    "ProjectName": "DotNetZip",
    "ReportedDate": "2009-11-26T15:10:13.567-08:00",
    "Status": {
      "Name": "Closed",
      "Id": 4
    },
    "ReasonClosed": {
      "Name": "Unassigned"
    },
    "Summary": "bug in ZLibStream.cs - Read function return 0 bytes in decompress",
    "Type": {
      "Name": "Issue",
      "Id": 3
    },
    "VoteCount": 1,
    "Id": 9323
  },
  "FileAttachments": [
    {
      "FileId": 2448,
      "FileName": "x.txt",
      "DownloadUrl": ".\\2448"
    },
    {
      "FileId": 2549,
      "FileName": "Cheeso-wi9323-output.txt",
      "DownloadUrl": ".\\2549"
    }
  ],
  "Comments": [
    {
      "Message": "I don't understand this bug.  I took your code and ran it against v1.9; it worked fine.   I inserted diagnostic outputs into the program; everything looked normal.  The file compressed, and then decompressed, just fine.  see the attached file here:  Cheeso-wi9323-Output.txt for my modified source code and test output.   I don't understand what the problem is.  ",
      "PostedDate": "2009-12-27T13:32:30.49-08:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2009-12-27T13:32:33.773-08:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2009-12-27T13:33:10.59-08:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2013-02-21T18:43:46.917-08:00",
      "Id": -2147483648
    },
    {
      "Message": "",
      "PostedDate": "2013-05-16T05:31:58.45-07:00",
      "Id": -2147483648
    }
  ]
}