Skip to content

Decompress suppresses Z_BUF_ERROR #28

@e-n-f

Description

@e-n-f

The reader loop in decompress.hpp suppresses Z_BUF_ERROR so it doesn't detect truncated input files.

I think the right way to do it is probably as in this change to Tippecanoe's code copied and pasted from the same place: mapbox/tippecanoe@07ab900.

With this change, the loop terminates only on Z_STREAM_END, so in the case of a truncated stream, it continues trying to decompress and reports Z_BUF_ERROR instead of the current behavior of terminating because the input has all been consumed even though the decompressor is still expecting more.

This also attempts to clean up what has always seemed like confusing logic to me about the size of the output buffer, the size of the output so far, and zlib's pointers into the buffer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions