Skip to content

Regarding LZMA1 (LZMA Alone, Method ID 14) in libzip (Follow-up of #195) #198

Closed
@ghost

Description

To use the LZMA library (XZ Utils) for Method ID 14, I guess we need to refer to libarchive's implementation: archive_read_support_format_zip.c

So, in order to use the "lzma alone" decoder for the zipx lzma
stream, we simply need to shuffle around some fields, prepare a new
lzma alone header, feed it into lzma alone decoder so it will
initialize itself properly, and then we can start feeding normal
zipx lzma stream into the decoder.

That means the following code from zip_algorithm_xz.c is probably not enough (incomplete) and extra work/magic is needed to deal with LZMA1 ZIP files.

        if (ctx->method == ZIP_CM_LZMA)
            ret = lzma_alone_encoder(&ctx->zstr, filters[0].options);
        if (ctx->method == ZIP_CM_LZMA)
            ret = lzma_alone_decoder(&ctx->zstr, UINT64_MAX);

CC: @jinfeihan57


EDIT: See also libarchive/libarchive#1417
EDIT 2: See also https://sourceforge.net/p/lzmautils/discussion/708858/thread/663db6473d/#2919

Metadata

Metadata

Assignees

No one assigned

    Labels

    buglibzip doesn't behave as expected.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions