added additional condition so large offsets into the dictionary are not generated past windowSize
This commit is contained in:
@@ -675,11 +675,12 @@ static U32 generateSequences(U32* seed, frame_t* frame, seqStore_t* seqStore,
|
|||||||
do {
|
do {
|
||||||
if (RAND(seed) & 7) {
|
if (RAND(seed) & 7) {
|
||||||
/* do a normal offset */
|
/* do a normal offset */
|
||||||
|
U32 const dataDecompressed = (U32)((BYTE*)srcPtr-(BYTE*)frame->srcStart);
|
||||||
offset = (RAND(seed) %
|
offset = (RAND(seed) %
|
||||||
MIN(frame->header.windowSize,
|
MIN(frame->header.windowSize,
|
||||||
(size_t)((BYTE*)srcPtr - (BYTE*)frame->srcStart))) +
|
(size_t)((BYTE*)srcPtr - (BYTE*)frame->srcStart))) +
|
||||||
1;
|
1;
|
||||||
if (info.useDict && (RAND(seed) & 1) && i + 1 != numSequences) {
|
if (info.useDict && (RAND(seed) & 1) && i + 1 != numSequences && dataDecompressed < frame->header.windowSize) {
|
||||||
/* need to occasionally generate offsets that go past the start */
|
/* need to occasionally generate offsets that go past the start */
|
||||||
/* including i+1 != numSequences because the last sequences has to adhere to predetermined contentSize */
|
/* including i+1 != numSequences because the last sequences has to adhere to predetermined contentSize */
|
||||||
U32 lenPastStart = (RAND(seed) % info.dictContentSize) + 1;
|
U32 lenPastStart = (RAND(seed) % info.dictContentSize) + 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user