summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexey Tourbin <alexey.tourbin@gmail.com>2018-04-26 04:46:26 (GMT)
committerAlexey Tourbin <alexey.tourbin@gmail.com>2018-04-26 05:23:54 (GMT)
commit5603d30f81c99fbe55f48d953e3df728720ff982 (patch)
treea0c27174b8e5e9661f760ae86879c9f71790faf3 /tests
parentb4eda8d08f307dfc3cbd0d06baea4e6c581b70de (diff)
downloadlz4-5603d30f81c99fbe55f48d953e3df728720ff982.zip
lz4-5603d30f81c99fbe55f48d953e3df728720ff982.tar.gz
lz4-5603d30f81c99fbe55f48d953e3df728720ff982.tar.bz2
lz4.c: fixed the LZ4_decompress_safe_continue case
The previous change broke decoding with a ring buffer. That's because I didn't realize that the "double dictionary mode" was possible, i.e. that the decoding routine can look both at the first part of the dictionary passed as prefix and the second part passed via dictStart+dictSize. So this change introduces the LZ4_decompress_safe_doubleDict helper, which handles this "double dictionary" situation. (This is a bit of a misnomer, there is only one dictionary, but I can't think of a better name, and perhaps the designation is not all too bad.) The helper is used only once, in LZ4_decompress_safe_continue, it should be inlined with LZ4_FORCE_O2_GCC_PPC64LE attached to LZ4_decompress_safe_continue. (Also, in the helper functions, I change the dictStart parameter type to "const void*", to avoid a cast when calling helpers. In the helpers, the upcast to "BYTE*" is still required, for compatibility with C++.) So this fixes the case of LZ4_decompress_safe_continue, and I'm surprised by the fact that the fuzzer is now happy and does not detect a similar problem with LZ4_decompress_fast_continue. So before fixing LZ4_decompress_fast_continue, the next logical step is to enhance the fuzzer.
Diffstat (limited to 'tests')
-rw-r--r--tests/fullbench.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/fullbench.c b/tests/fullbench.c
index f489392..1939aeb 100644
--- a/tests/fullbench.c
+++ b/tests/fullbench.c
@@ -277,7 +277,7 @@ static int local_LZ4_decompress_safe_usingDict(const char* in, char* out, int in
}
#ifndef LZ4_DLL_IMPORT
-extern int LZ4_decompress_safe_forceExtDict(const char* in, char* out, int inSize, int outSize, const char* dict, int dictSize);
+extern int LZ4_decompress_safe_forceExtDict(const char* in, char* out, int inSize, int outSize, const void* dict, size_t dictSize);
static int local_LZ4_decompress_safe_forceExtDict(const char* in, char* out, int inSize, int outSize)
{