Skip to content

0 byte buffers writing 0 bytes fails CRC #183

Description

@michaelaird

Steps to reproduce

I'm not entirely sure what causes this. We're streaming encrypted blobs from Azure asynchronously into a ZipOutputStream. I think it depends on the file size. When the final block is being flushed, it tries to call write with a 0 length buffer, an offset of 0 and a count of 0.

Expected behavior

Stream should be zipped successfully.

Actual behavior

CRC check throws a "not a valid index into buffer" exception

I think either
-the CRC should allow for 0 length byte[], 0 offset, 0 count or,
-the . Write(byte[] buffer, int offset, int count) method should just return if the arguments are 0 length byte[], 0 offset, 0 count (nothing passed in, nothing to do)

Version of SharpZipLib

ICSharpCode.SharpZipLib-dogfood.1.0.296

Obtained from (place an x between the brackets for all that apply)

  • Package installed using:
  • NuGet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions