Skip to content

1.1.4 doesn't write content size to frame header when using multi-threaded APIs #634

@indygreg

Description

@indygreg

Upon upgrading to 1.1.4, python-zstandard's test suite raised a few failures related to the content size not being written into the frame header when using the multi-threaded compression APIs. You can see the test failures by following links to Travis or AppVeyor in indygreg/python-zstandard#17.

I haven't tested the C code explicitly, but what python-zstandard is doing is roughly:

ZSTD_parameters zparams;
memset(&zparams, 0, sizeof(zparams));
destSize = ZSTD_compressBound(sourceSize);

zparams.cParams = ZSTD_getCParams(3, sourceSize, 0);
zparams.fParams.contentSizeFlag = 1;

cctx = ZSTDMT_createCCtx(threads);
ZSTDMT_compressCCtx(cctx, dest, destSize, source, sourceSize, 3);

In 1.1.3, the content size was written into the frame header. In 1.1.4, it isn't. This feels like a regression.

The same behavior occurs with ZSTDMT_initCStream_advanced() + ZSTDMT_compressStream(). So this feels like something inside ZSTDMT functions not looking at fParams. That, or python-zstandard was doing something wrong before and zstd changed behavior to expose a bug. Either way, it feels like an issue worth reporting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions