examples/dictionaryRandomAccess.c fails when given file is smaller than 1024 bytes
Author: t-matCreated Nov 15, 2024Updated Sep 6, 2026
Describe the bug
examples/dictionaryRandomAccess.c doesn't work with a small file which is less than 1024 bytes (DICTIONARY_BYTES).
To Reproduce
make
# OK
./examples/dictionaryRandomAccess README.md README.md 0 10
# NG (for small files)
./examples/dictionaryRandomAccess .gitattributes .gitattributes 0 10Additional context
I'll write a PR for this issue. But the following patch may work.
https://github.com/lz4/lz4/blob/v1.10.0/examples/dictionaryRandomAccess.c#L254
- test_decompress(outFp, inpFp, dict, DICTIONARY_BYTES, offset, length);
+ test_decompress(outFp, inpFp, dict, dictSize, offset, length);Source: lz4/lz4