Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZDICT_trainFromBuffer_cover is not thread safe #4045

Open
as-com opened this issue May 14, 2024 · 0 comments
Open

ZDICT_trainFromBuffer_cover is not thread safe #4045

as-com opened this issue May 14, 2024 · 0 comments

Comments

@as-com
Copy link

as-com commented May 14, 2024

Describe the bug

ZDICT_trainFromBuffer_cover is not thread safe due to the use of global state:

/* We need a global context for qsort... */
static COVER_ctx_t *g_coverCtx = NULL;

Calling this function from multiple threads may result in segfault/access violation, use-after-free and other badness.

To Reproduce
Call ZDICT_trainFromBuffer_cover from multiple threads

Desktop (please complete the following information):

  • OS: Windows
  • Version 11 23H2
  • Compiler: MSVC, Visual Studio 2022
  • Flags: default
  • Other relevant hardware specs: N/A
  • Build system: whatever zstd-sys/cargo uses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant