Skip to content

PNG inflate is sometimes missing last byte #414

@kmcallister

Description

@kmcallister

In some cases inflate.rs skips the last byte of the decompressed stream, e.g.:

input   02 ec 30 00
flate2  c3
piston

input   02 c8 00 30 00
flate2  30
piston

input   f2 84 00 80 00 0b 00 30
flate2  49 49 49 49 49 49 49 50
piston  49 49 49 49 49 49 49

input   da 30 7f f1 5d 80 00 ab 00 30
flate2  b0 9f a3 dd 78
piston  b0 9f a3 dd

input   da ff 80 30 30 82 00 80 00 cb 00 30
flate2  bf e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0
        e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0
        e0 e0 e0 e0 32 32 32 32 32 32 32 68
piston  bf e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0
        e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0 e0
        e0 e0 e0 e0 32 32 32 32 32 32 32

input   f2 00 01 80 00 13 00 30
flate2  48 48 48 48 48 10
piston  48 48 48 48 48

(I found these examples using afl.rs.)

I found some other discrepancies in the inflate implementation that I haven't categorized yet. I might hold off on that, if @nwin's new PNG decoder using libflate2 will be ready soon.

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