Skip to content

Fix Zstandard metadata decompression for frames without declared content size #854

Description

@sr-rossanderson

Patchman can fail when processing YUM/DNF repository metadata compressed with Zstandard where the frame does not expose a known decompressed content size.

This was encountered against modern EL9 repository metadata.

Current behaviour:

could not determine content size in frame header

Expected behaviour:

Patchman should be able to decompress valid Zstandard repository metadata regardless of whether the frame declares its decompressed content size.

Suggested fix:

Use streaming decompression instead of an API which requires the output size to be known, for example:

from io import BytesIO
import zstandard

dctx = zstandard.ZstdDecompressor()

with dctx.stream_reader(BytesIO(contents)) as reader:
    decompressed = reader.read()

Impact:

This prevents Patchman from consuming some current EL8/EL9-style repository metadata.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions