]> git.ipfire.org Git - thirdparty/zstd.git/commit
zstdmt : fix : loading prefix from previous segments
authorYann Collet <cyan@fb.com>
Fri, 24 Feb 2017 07:42:12 +0000 (23:42 -0800)
committerYann Collet <cyan@fb.com>
Fri, 24 Feb 2017 07:42:12 +0000 (23:42 -0800)
commit14312d833e1249de7bb0caa916d83993d2fa33be
tree84554f44909f0c060ef113e05ee3b8c51f6cd0cd
parent831b4890ce7db8c3771e2ef9bfc2b5c929b5ac2b
zstdmt : fix : loading prefix from previous segments

There used to be a (very small) chance that
loading prefix from previous segment
would be confused with a real zstd dictionary.
For that to happen, the prefix needs to start
with the same value as dictionary magic.
That's 1 chance in 4 billions if all values have equal probability.
But in fact, since some values are more common (0x00000000 for example)
others are less common, and dictionary magic was selected to be one of them,
so probabilities are likely even lower.

Anyway, this risk is no down to zero
by adding a new CCtx parameter : ZSTD_p_forceRawDict

Current parameter policy : the parameter "stick" to its CCtx,
so any dictionary loading after ZSTD_p_forceRawDict is set
will be loaded in "raw" ("content only") mode,
even if CCtx is re-used multiple times with multiple different dictionary.
It's up to the user to reset this value differently if it needs so.
doc/zstd_manual.html
lib/compress/zstd_compress.c
lib/compress/zstdmt_compress.c
lib/zstd.h