summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2014-06-05 00:59:19 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2014-06-05 00:59:19 (GMT)
commitc4f5b9de2a6483e4a2c962e2c7a0037fe42aee59 (patch)
treecc3959c2eb8782303f19fe7af515181706501f1b
parent140e6e72ddb6fc5f7cd28ce0c8ec3812ef4a9c08 (diff)
downloadlz4-c4f5b9de2a6483e4a2c962e2c7a0037fe42aee59.zip
lz4-c4f5b9de2a6483e4a2c962e2c7a0037fe42aee59.tar.gz
lz4-c4f5b9de2a6483e4a2c962e2c7a0037fe42aee59.tar.bz2
Fixed (continued) : address space overflow in 32-bits mode
-rwxr-xr-xlz4.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lz4.c b/lz4.c
index 0f1ee7a..cb5c3db 100755
--- a/lz4.c
+++ b/lz4.c
@@ -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);