]> git.ipfire.org Git - thirdparty/zstd.git/commit
Restore setting loadedDictEnd 1050/head
authorNick Terrell <terrelln@fb.com>
Fri, 16 Mar 2018 01:52:38 +0000 (18:52 -0700)
committerNick Terrell <terrelln@fb.com>
Fri, 16 Mar 2018 21:54:06 +0000 (14:54 -0700)
commit4af1fafeb80db846d7931a5fdfd6c24108761770
tree05f7af8899e9e4ed73355bcf395b3b15df20d171
parent192542b63c76d6f54b6a2119790488d6fb312ef8
Restore setting loadedDictEnd

Setting `loadedDictEnd` was accidently removed from `ZSTD_loadDictionaryContent()`,
which means that dictionary compression will only be able to reference the parts of
the dictionary within the window. The spec allows us to reference the entire
dictionary so long as even one byte is in the window.

`ZSTD_enforceMaxDist()` incorrectly always allowed offsets up to `loadedDictEnd`
beyond the window, even once the dictionary was out of range.

When overflow protection kicked in, the check `current > loadedDictEnd + maxDist`
is incorrect if `loadedDictEnd` isn't reset back to zero. `current` could be reset
below the value, which would incorrectly allow references beyond the window. This
bug is present in `master`, but is very hard to trigger, since it requires both
dictionaries and data which triggers overflow correction.
lib/compress/zstd_compress.c
lib/compress/zstd_compress_internal.h
lib/compress/zstd_ldm.c