mirror of
https://github.com/facebook/zstd.git
synced 2025-11-29 00:04:37 -05:00
add requested check for legacy decoder v0.1
which uses a different technique to store literals, and therefore must check for potential overwrites.
This commit is contained in:
parent
9419747171
commit
c5bf6b8b88
@ -1735,6 +1735,7 @@ static size_t ZSTD_execSequence(BYTE* op,
|
|||||||
|
|
||||||
if (endMatch > oend) return ERROR(dstSize_tooSmall); /* overwrite beyond dst buffer */
|
if (endMatch > oend) return ERROR(dstSize_tooSmall); /* overwrite beyond dst buffer */
|
||||||
if (litEnd > litLimit) return ERROR(corruption_detected); /* overRead beyond lit buffer */
|
if (litEnd > litLimit) return ERROR(corruption_detected); /* overRead beyond lit buffer */
|
||||||
|
if (sequence.matchLength > (size_t)(*litPtr-op)) return ERROR(dstSize_tooSmall); /* overwrite literal segment */
|
||||||
|
|
||||||
/* copy Literals */
|
/* copy Literals */
|
||||||
ZSTD_memmove(op, *litPtr, sequence.litLength); /* note : v0.1 seems to allow scenarios where output or input are close to end of buffer */
|
ZSTD_memmove(op, *litPtr, sequence.litLength); /* note : v0.1 seems to allow scenarios where output or input are close to end of buffer */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user