diff options
author | Yann Collet <yann.collet.73@gmail.com> | 2014-06-05 00:59:19 (GMT) |
---|---|---|
committer | Yann Collet <yann.collet.73@gmail.com> | 2014-06-05 00:59:19 (GMT) |
commit | c4f5b9de2a6483e4a2c962e2c7a0037fe42aee59 (patch) | |
tree | cc3959c2eb8782303f19fe7af515181706501f1b | |
parent | 140e6e72ddb6fc5f7cd28ce0c8ec3812ef4a9c08 (diff) | |
download | lz4-c4f5b9de2a6483e4a2c962e2c7a0037fe42aee59.zip lz4-c4f5b9de2a6483e4a2c962e2c7a0037fe42aee59.tar.gz lz4-c4f5b9de2a6483e4a2c962e2c7a0037fe42aee59.tar.bz2 |
Fixed (continued) : address space overflow in 32-bits mode
-rwxr-xr-x | lz4.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -742,6 +742,10 @@ int LZ4_compress_usingDict (LZ4_dict_t* LZ4_dict, const char* source, char* dest LZ4_dict_t_internal* streamPtr = (LZ4_dict_t_internal*)LZ4_dict; const BYTE* const dictEnd = streamPtr->dictionary + streamPtr->dictSize; + const BYTE* smallest = dictEnd; + if (smallest > (const BYTE*) source) smallest = (const BYTE*) source; + LZ4_renormDictT((LZ4_dict_t_internal*)LZ4_dict, smallest); + if (dictEnd == (const BYTE*)source) { int result = LZ4_compress_generic(LZ4_dict, source, dest, inputSize, 0, notLimited, byU32, withPrefix64k); @@ -764,6 +768,10 @@ int LZ4_compress_limitedOutput_usingDict (LZ4_dict_t* LZ4_dict, const char* sour LZ4_dict_t_internal* streamPtr = (LZ4_dict_t_internal*)LZ4_dict; const BYTE* const dictEnd = streamPtr->dictionary + streamPtr->dictSize; + const BYTE* smallest = dictEnd; + if (smallest > (const BYTE*) source) smallest = (const BYTE*) source; + LZ4_renormDictT((LZ4_dict_t_internal*)LZ4_dict, smallest); + if (dictEnd == (const BYTE*)source) { int result = LZ4_compress_generic(LZ4_dict, source, dest, inputSize, maxOutputSize, limitedOutput, byU32, withPrefix64k); |