mirror of
https://github.com/facebook/zstd.git
synced 2025-08-01 09:47:01 +03:00
fixed asan
This commit is contained in:
@ -81,7 +81,6 @@ typedef BYTE litDistribTable[LTSIZE];
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************************************************
|
||||
* Local Functions
|
||||
*********************************************************/
|
||||
@ -130,7 +129,7 @@ static BYTE RDG_genChar(U32* seed, const litDistribTable lt)
|
||||
}
|
||||
|
||||
|
||||
#define RDG_RAND15BITS ((RDG_rand(seed) >> 3) & 32767)
|
||||
#define RDG_RAND15BITS ((RDG_rand(seed) >> 3) & 0x7FFF)
|
||||
#define RDG_RANDLENGTH ( ((RDG_rand(seed) >> 7) & 7) ? (RDG_rand(seed) & 15) : (RDG_rand(seed) & 511) + 15)
|
||||
void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double matchProba, litDistribTable lt, unsigned* seedPtr)
|
||||
{
|
||||
@ -168,16 +167,16 @@ void RDG_genBlock(void* buffer, size_t buffSize, size_t prefixSize, double match
|
||||
{
|
||||
/* Copy (within 32K) */
|
||||
size_t match;
|
||||
size_t length = RDG_RANDLENGTH + 4;
|
||||
size_t d;
|
||||
int length = RDG_RANDLENGTH + 4;
|
||||
U32 offset = RDG_RAND15BITS + 1;
|
||||
U32 repeatOffset = (RDG_rand(seed) & 15) == 2;
|
||||
if (repeatOffset) offset = prevOffset;
|
||||
if (offset > pos) offset = (U32)pos;
|
||||
match = pos - offset;
|
||||
if (length > buffSize-pos) length = buffSize-pos;
|
||||
memcpy(buffPtr+pos, buffPtr+match, length);
|
||||
pos += length;
|
||||
prevOffset = offset;
|
||||
d = pos + length;
|
||||
if (d > buffSize) d = buffSize;
|
||||
while (pos < d) buffPtr[pos++] = buffPtr[match++]; /* correctly manages overlaps */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user