Fix ZSTD_execSequence() edge case
parent
f405b8acbe
commit
7158584399
|
@ -878,7 +878,12 @@ size_t ZSTD_execSequence(BYTE* op,
|
||||||
op = oLitEnd + length1;
|
op = oLitEnd + length1;
|
||||||
sequence.matchLength -= length1;
|
sequence.matchLength -= length1;
|
||||||
match = base;
|
match = base;
|
||||||
|
if (op > oend_w) {
|
||||||
|
memmove(op, match, sequence.matchLength);
|
||||||
|
return sequenceLength;
|
||||||
|
}
|
||||||
} }
|
} }
|
||||||
|
/* Requirement: op <= oend_w */
|
||||||
|
|
||||||
/* match within prefix */
|
/* match within prefix */
|
||||||
if (sequence.offset < 8) {
|
if (sequence.offset < 8) {
|
||||||
|
|
|
@ -3107,8 +3107,13 @@ static size_t ZSTD_execSequence(BYTE* op,
|
||||||
op = oLitEnd + length1;
|
op = oLitEnd + length1;
|
||||||
sequence.matchLength -= length1;
|
sequence.matchLength -= length1;
|
||||||
match = base;
|
match = base;
|
||||||
|
if (op > oend_8) {
|
||||||
|
memmove(op, match, sequence.matchLength);
|
||||||
|
return sequenceLength;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Requirement: op <= oend_8 */
|
||||||
|
|
||||||
/* match within prefix */
|
/* match within prefix */
|
||||||
if (sequence.offset < 8)
|
if (sequence.offset < 8)
|
||||||
|
|
|
@ -3312,7 +3312,12 @@ static size_t ZSTDv05_execSequence(BYTE* op,
|
||||||
op = oLitEnd + length1;
|
op = oLitEnd + length1;
|
||||||
sequence.matchLength -= length1;
|
sequence.matchLength -= length1;
|
||||||
match = base;
|
match = base;
|
||||||
|
if (op > oend_8) {
|
||||||
|
memmove(op, match, sequence.matchLength);
|
||||||
|
return sequenceLength;
|
||||||
|
}
|
||||||
} }
|
} }
|
||||||
|
/* Requirement: op <= oend_8 */
|
||||||
|
|
||||||
/* match within prefix */
|
/* match within prefix */
|
||||||
if (sequence.offset < 8) {
|
if (sequence.offset < 8) {
|
||||||
|
|
|
@ -3466,7 +3466,12 @@ size_t ZSTDv06_execSequence(BYTE* op,
|
||||||
op = oLitEnd + length1;
|
op = oLitEnd + length1;
|
||||||
sequence.matchLength -= length1;
|
sequence.matchLength -= length1;
|
||||||
match = base;
|
match = base;
|
||||||
|
if (op > oend_8) {
|
||||||
|
memmove(op, match, sequence.matchLength);
|
||||||
|
return sequenceLength;
|
||||||
|
}
|
||||||
} }
|
} }
|
||||||
|
/* Requirement: op <= oend_8 */
|
||||||
|
|
||||||
/* match within prefix */
|
/* match within prefix */
|
||||||
if (sequence.offset < 8) {
|
if (sequence.offset < 8) {
|
||||||
|
|
|
@ -3690,7 +3690,12 @@ size_t ZSTDv07_execSequence(BYTE* op,
|
||||||
op = oLitEnd + length1;
|
op = oLitEnd + length1;
|
||||||
sequence.matchLength -= length1;
|
sequence.matchLength -= length1;
|
||||||
match = base;
|
match = base;
|
||||||
|
if (op > oend_w) {
|
||||||
|
memmove(op, match, sequence.matchLength);
|
||||||
|
return sequenceLength;
|
||||||
|
}
|
||||||
} }
|
} }
|
||||||
|
/* Requirement: op <= oend_w */
|
||||||
|
|
||||||
/* match within prefix */
|
/* match within prefix */
|
||||||
if (sequence.offset < 8) {
|
if (sequence.offset < 8) {
|
||||||
|
|
Loading…
Reference in New Issue