fixed asan warnings
This commit is contained in:
parent
89db5e001d
commit
93a823ccb7
@ -751,7 +751,7 @@ size_t ZSTD_compressBlock_fast_generic(ZSTD_CCtx* ctx,
|
|||||||
if ( (match < lowest) ||
|
if ( (match < lowest) ||
|
||||||
(MEM_read32(match) != MEM_read32(ip)) )
|
(MEM_read32(match) != MEM_read32(ip)) )
|
||||||
{ ip += ((ip-anchor) >> g_searchStrength) + 1; offset_2 = offset_1; continue; }
|
{ ip += ((ip-anchor) >> g_searchStrength) + 1; offset_2 = offset_1; continue; }
|
||||||
while ((ip>anchor) && (match>base) && (ip[-1] == match[-1])) { ip--; match--; } /* catch up */
|
while ((ip>anchor) && (match>lowest) && (ip[-1] == match[-1])) { ip--; match--; } /* catch up */
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t litLength = ip-anchor;
|
size_t litLength = ip-anchor;
|
||||||
@ -804,7 +804,7 @@ size_t ZSTD_compressBlock_fast(ZSTD_CCtx* ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FORCE_INLINE
|
//FORCE_INLINE
|
||||||
size_t ZSTD_compressBlock_fast_extDict_generic(ZSTD_CCtx* ctx,
|
size_t ZSTD_compressBlock_fast_extDict_generic(ZSTD_CCtx* ctx,
|
||||||
void* dst, size_t maxDstSize,
|
void* dst, size_t maxDstSize,
|
||||||
const void* src, size_t srcSize,
|
const void* src, size_t srcSize,
|
||||||
|
@ -488,45 +488,72 @@ FORCE_INLINE size_t ZSTD_execSequence(BYTE* op,
|
|||||||
/* check */
|
/* check */
|
||||||
//if (match > op) return ERROR(corruption_detected); /* address space overflow test (is clang optimizer wrongly removing this test ?) */
|
//if (match > op) return ERROR(corruption_detected); /* address space overflow test (is clang optimizer wrongly removing this test ?) */
|
||||||
if (sequence.offset > (size_t)op) return ERROR(corruption_detected); /* address space overflow test (this test seems kept by clang optimizer) */
|
if (sequence.offset > (size_t)op) return ERROR(corruption_detected); /* address space overflow test (this test seems kept by clang optimizer) */
|
||||||
if (match < vBase) return ERROR(corruption_detected);
|
|
||||||
|
|
||||||
if (match < base) match = dictEnd - (base-match); /* only works if match + matchLength <= dictEnd */
|
if (match < base)
|
||||||
|
{
|
||||||
|
/* offset beyond prefix */
|
||||||
|
if (match < vBase) return ERROR(corruption_detected);
|
||||||
|
match = dictEnd - (base-match);
|
||||||
|
if (match + sequence.matchLength <= dictEnd - 8)
|
||||||
|
{
|
||||||
|
ZSTD_wildcopy(op, match, sequence.matchLength-8); /* works even if matchLength < 8 */
|
||||||
|
return oMatchEnd - ostart;
|
||||||
|
}
|
||||||
|
if (match + sequence.matchLength <= dictEnd)
|
||||||
|
{
|
||||||
|
memcpy(op, match, sequence.matchLength);
|
||||||
|
return oMatchEnd - ostart;
|
||||||
|
}
|
||||||
|
/* span extDict & currentPrefixSegment */
|
||||||
|
{
|
||||||
|
size_t length1 = dictEnd - match;
|
||||||
|
size_t length2 = sequence.matchLength - length1;
|
||||||
|
memcpy(op, match, length1);
|
||||||
|
op += length1;
|
||||||
|
memcpy(op, base, length2); /* will fail in case of overlapping match */
|
||||||
|
return oMatchEnd - ostart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* close range match, overlap */
|
{
|
||||||
if (sequence.offset < 8)
|
/* match within prefix */
|
||||||
{
|
if (sequence.offset < 8)
|
||||||
const int dec64 = dec64table[sequence.offset];
|
{
|
||||||
op[0] = match[0];
|
/* close range match, overlap */
|
||||||
op[1] = match[1];
|
const int dec64 = dec64table[sequence.offset];
|
||||||
op[2] = match[2];
|
op[0] = match[0];
|
||||||
op[3] = match[3];
|
op[1] = match[1];
|
||||||
match += dec32table[sequence.offset];
|
op[2] = match[2];
|
||||||
ZSTD_copy4(op+4, match);
|
op[3] = match[3];
|
||||||
match -= dec64;
|
match += dec32table[sequence.offset];
|
||||||
}
|
ZSTD_copy4(op+4, match);
|
||||||
else
|
match -= dec64;
|
||||||
{
|
}
|
||||||
ZSTD_copy8(op, match);
|
else
|
||||||
}
|
{
|
||||||
op += 8; match += 8;
|
ZSTD_copy8(op, match);
|
||||||
|
}
|
||||||
|
op += 8; match += 8;
|
||||||
|
|
||||||
|
if (oMatchEnd > oend-12)
|
||||||
|
{
|
||||||
|
if (op < oend_8)
|
||||||
|
{
|
||||||
|
ZSTD_wildcopy(op, match, oend_8 - op);
|
||||||
|
match += oend_8 - op;
|
||||||
|
op = oend_8;
|
||||||
|
}
|
||||||
|
while (op < oMatchEnd) *op++ = *match++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ZSTD_wildcopy(op, match, sequence.matchLength-8); /* works even if matchLength < 8 */
|
||||||
|
}
|
||||||
|
return oMatchEnd - ostart;
|
||||||
|
}
|
||||||
|
|
||||||
if (oMatchEnd > oend-12)
|
|
||||||
{
|
|
||||||
if (op < oend_8)
|
|
||||||
{
|
|
||||||
ZSTD_wildcopy(op, match, oend_8 - op);
|
|
||||||
match += oend_8 - op;
|
|
||||||
op = oend_8;
|
|
||||||
}
|
|
||||||
while (op < oMatchEnd) *op++ = *match++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ZSTD_wildcopy(op, match, sequence.matchLength-8); /* works even if matchLength < 8 */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return oMatchEnd - ostart;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t ZSTD_decompressSequences(
|
static size_t ZSTD_decompressSequences(
|
||||||
|
@ -336,9 +336,7 @@ size_t benchMem(void* src, size_t srcSize, U32 benchNb)
|
|||||||
if (bp.blockType != bt_compressed)
|
if (bp.blockType != bt_compressed)
|
||||||
{
|
{
|
||||||
DISPLAY("ZSTD_decodeLiteralsBlock : impossible to test on this sample (not compressible)\n");
|
DISPLAY("ZSTD_decodeLiteralsBlock : impossible to test on this sample (not compressible)\n");
|
||||||
free(dstBuff);
|
goto _cleanOut;
|
||||||
free(buff2);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
memcpy(buff2, dstBuff+7, g_cSize-7);
|
memcpy(buff2, dstBuff+7, g_cSize-7);
|
||||||
srcSize = srcSize > 128 KB ? 128 KB : srcSize; // relative to block
|
srcSize = srcSize > 128 KB ? 128 KB : srcSize; // relative to block
|
||||||
@ -356,9 +354,7 @@ size_t benchMem(void* src, size_t srcSize, U32 benchNb)
|
|||||||
if (bp.blockType != bt_compressed)
|
if (bp.blockType != bt_compressed)
|
||||||
{
|
{
|
||||||
DISPLAY("ZSTD_decodeSeqHeaders : impossible to test on this sample (not compressible)\n");
|
DISPLAY("ZSTD_decodeSeqHeaders : impossible to test on this sample (not compressible)\n");
|
||||||
free(dstBuff);
|
goto _cleanOut;
|
||||||
free(buff2);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
iend = ip + 3 + blockSize; /* End of first block */
|
iend = ip + 3 + blockSize; /* End of first block */
|
||||||
ip += 3; /* skip block header */
|
ip += 3; /* skip block header */
|
||||||
@ -419,6 +415,7 @@ size_t benchMem(void* src, size_t srcSize, U32 benchNb)
|
|||||||
|
|
||||||
DISPLAY("%2u- %-30.30s : %7.1f MB/s (%9u)\n", benchNb, benchName, (double)srcSize / bestTime / 1000., (U32)errorCode);
|
DISPLAY("%2u- %-30.30s : %7.1f MB/s (%9u)\n", benchNb, benchName, (double)srcSize / bestTime / 1000., (U32)errorCode);
|
||||||
|
|
||||||
|
_cleanOut:
|
||||||
free(dstBuff);
|
free(dstBuff);
|
||||||
free(buff2);
|
free(buff2);
|
||||||
ZSTD_freeDCtx(g_dctxPtr);
|
ZSTD_freeDCtx(g_dctxPtr);
|
||||||
|
Loading…
Reference in New Issue
Block a user