ZDICT_trainFromBuffer_cover is not thread safe
as-com opened this issue · comments
Andrew Sun commented
Describe the bug
ZDICT_trainFromBuffer_cover is not thread safe due to the use of global state:
Lines 235 to 236 in 78955f5
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