diff options
author | klebertosantos <fixbugsufcg@gmail.com> | 2021-03-10 12:37:57 (GMT) |
---|---|---|
committer | klebertosantos <fixbugsufcg@gmail.com> | 2021-03-10 12:37:57 (GMT) |
commit | 29a6a1f4941e7243241fe00d6c13b749fd6b60c2 (patch) | |
tree | 05e06bc3f79a00b70be74472ff3cf6425777d1ab | |
parent | 1d58f77818f2ac8c18e89a884826c9fa8acba295 (diff) | |
download | lz4-29a6a1f4941e7243241fe00d6c13b749fd6b60c2.zip lz4-29a6a1f4941e7243241fe00d6c13b749fd6b60c2.tar.gz lz4-29a6a1f4941e7243241fe00d6c13b749fd6b60c2.tar.bz2 |
fix null pointer dereference
-rw-r--r-- | lib/lz4hc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c index e2e4f00..350709b 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -953,13 +953,15 @@ int LZ4_compress_HC_extStateHC (void* state, const char* src, char* dst, int src int LZ4_compress_HC(const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel) { + int cSize; #if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1 LZ4_streamHC_t* const statePtr = (LZ4_streamHC_t*)ALLOC(sizeof(LZ4_streamHC_t)); + if (statePtr==NULL) return 0; #else LZ4_streamHC_t state; LZ4_streamHC_t* const statePtr = &state; #endif - int const cSize = LZ4_compress_HC_extStateHC(statePtr, src, dst, srcSize, dstCapacity, compressionLevel); + cSize = LZ4_compress_HC_extStateHC(statePtr, src, dst, srcSize, dstCapacity, compressionLevel); #if defined(LZ4HC_HEAPMODE) && LZ4HC_HEAPMODE==1 FREEMEM(statePtr); #endif |