Skip to content

ZSTD_initStaticCDict does not set level and it results in use of uninit value #3525

@danlark1

Description

@danlark1

Describe the bug

ZSTD_initStaticCDict does not set compression level

To Reproduce

While running under msan, we found an error

==9312==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f4749a338a5 in ZSTD_compressBegin_usingCDict_internal zstd/compress/zstd_compress.c:5503:9
    #1 0x7f4749a339e3 in ZSTD_compress_usingCDict_internal zstd/compress/zstd_compress.c:5548:5
    #2 0x7f4749a339e3 in ZSTD_compress_usingCDict zstd/compress/zstd_compress.c:5574:12
    #3 0x7f474a860012 in basicUnitTests zstd/tests/fuzzer.c:2596:29
    #4 0x7f474a8505b2 in main zstd/tests/fuzzer.c:4734:18

This is the error

ZSTD_CCtxParams_init_internal(&cctxParams, &params, cdict->compressionLevel);

cdict->compressionLevel was not set during initialization

Expected behavior

No msan error

Desktop (please complete the following information):

  • OS: Linux
  • Compiler: clang

Additional context
Should be easy to fix

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions