summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--lib/lz4.c2
-rw-r--r--lib/lz4frame.c1
-rw-r--r--lib/lz4hc.c8
4 files changed, 7 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index e70c3db..da56ebc 100644
--- a/Makefile
+++ b/Makefile
@@ -162,10 +162,10 @@ usan: clean
CC=$(CC) CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' $(MAKE) test FUZZER_TIME="-T30s" NB_LOOPS=-i1
.PHONY: usan32
-usan32: CFLAGS = -m32 -O3 -g -fsanitize=undefined
+usan32: CFLAGS = -m32 -O3 -g -fsanitize=undefined -fno-sanitize-recover=undefined -fsanitize-recover=pointer-overflow
usan32: LDFLAGS = $(CFLAGS)
usan32: clean
- $(MAKE) test FUZZER_TIME="-T30s" NB_LOOPS=-i1
+ CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' $(MAKE) V=1 test FUZZER_TIME="-T30s" NB_LOOPS=-i1
SCANBUILD ?= scan-build
SCANBUILD_FLAGS += --status-bugs -v --force-analyze-debug-code
diff --git a/lib/lz4.c b/lib/lz4.c
index 8796f78..6f09b73 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1786,7 +1786,7 @@ typedef enum { decode_full_block = 0, partial_decode = 1 } earlyEnd_directive;
* does not know end of input
* presumes input is well formed
* note : will consume at least one byte */
-size_t read_long_length_no_check(const BYTE** pp)
+static size_t read_long_length_no_check(const BYTE** pp)
{
size_t b, l = 0;
do { b = **pp; (*pp)++; l += b; } while (b==255);
diff --git a/lib/lz4frame.c b/lib/lz4frame.c
index d1cc5f0..fde0c37 100644
--- a/lib/lz4frame.c
+++ b/lib/lz4frame.c
@@ -1085,7 +1085,6 @@ size_t LZ4F_uncompressedUpdate(LZ4F_cctx* cctxPtr,
void* dstBuffer, size_t dstCapacity,
const void* srcBuffer, size_t srcSize,
const LZ4F_compressOptions_t* compressOptionsPtr) {
- RETURN_ERROR_IF(cctxPtr->prefs.frameInfo.blockMode != LZ4F_blockIndependent, blockMode_invalid);
return LZ4F_compressUpdateImpl(cctxPtr,
dstBuffer, dstCapacity,
srcBuffer, srcSize,
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index 33b5de4..651f190 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -257,7 +257,7 @@ LZ4HC_InsertAndGetWiderMatch (
const HCfavor_e favorDecSpeed)
{
U16* const chainTable = hc4->chainTable;
- U32* const HashTable = hc4->hashTable;
+ U32* const hashTable = hc4->hashTable;
const LZ4HC_CCtx_internal * const dictCtx = hc4->dictCtx;
const BYTE* const prefixPtr = hc4->prefixStart;
const U32 prefixIdx = hc4->dictLimit;
@@ -280,8 +280,8 @@ LZ4HC_InsertAndGetWiderMatch (
assert(startpos != NULL);
*startpos = ip; /* in case there is no solution */
/* First Match */
- LZ4HC_Insert(hc4, ip);
- matchIndex = HashTable[LZ4HC_hashPtr(ip)];
+ LZ4HC_Insert(hc4, ip); /* insert all prior positions up to ip (excluded) */
+ matchIndex = hashTable[LZ4HC_hashPtr(ip)];
DEBUGLOG(7, "First candidate match for pos %u found at index %u / %u (lowestMatchIndex)",
ipIndex, matchIndex, lowestMatchIndex);
@@ -293,7 +293,7 @@ LZ4HC_InsertAndGetWiderMatch (
/* do nothing:
* favorDecSpeed intentionally skips matches with offset < 8 */
} else if (matchIndex >= prefixIdx) { /* within current Prefix */
- const BYTE* const matchPtr = prefixPtr + matchIndex - prefixIdx;
+ const BYTE* const matchPtr = prefixPtr + (matchIndex - prefixIdx);
assert(matchPtr < ip);
assert(longest >= 1);
if (LZ4_read16(iLowLimit + longest - 1) == LZ4_read16(matchPtr - lookBackLength + longest - 1)) {