diff options
author | yann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd> | 2012-08-22 15:59:39 (GMT) |
---|---|---|
committer | yann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd> | 2012-08-22 15:59:39 (GMT) |
commit | 9577c977a90bc85eaa2fe8550202a2cdf15b1e5f (patch) | |
tree | a94eca5963ae55f9104c93edbed1f7df439af565 | |
parent | f4e48fe61d37feec8781e7dd51166d827bfe3ea7 (diff) | |
download | lz4-9577c977a90bc85eaa2fe8550202a2cdf15b1e5f.zip lz4-9577c977a90bc85eaa2fe8550202a2cdf15b1e5f.tar.gz lz4-9577c977a90bc85eaa2fe8550202a2cdf15b1e5f.tar.bz2 |
Correction : LZ4_compress_limitedOutput() write too far error
git-svn-id: https://lz4.googlecode.com/svn/trunk@77 650e7d94-2a16-8b24-b05c-7c0b3f6821cd
-rw-r--r-- | lz4.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -449,6 +449,7 @@ _endCount: // Encode MatchLength
len = (int)(ip - anchor);
+ if unlikely(op + (1 + LASTLITERALS) + (len>>8) >= oend) return 0; // Check output limit
if (len>=(int)ML_MASK) { *token+=ML_MASK; len-=ML_MASK; for(; len > 509 ; len-=510) { *op++ = 255; *op++ = 255; } if (len > 254) { len-=255; *op++ = 255; } *op++ = (BYTE)len; }
else *token += len;
@@ -613,6 +614,7 @@ _endCount: // Encode MatchLength
len = (int)(ip - anchor);
+ if unlikely(op + (1 + LASTLITERALS) + (len>>8) >= oend) return 0; // Check output limit
if (len>=(int)ML_MASK) { *token+=ML_MASK; len-=ML_MASK; for(; len > 509 ; len-=510) { *op++ = 255; *op++ = 255; } if (len > 254) { len-=255; *op++ = 255; } *op++ = (BYTE)len; }
else *token += len;
|