summaryrefslogtreecommitdiffstats
path: root/lz4.c
diff options
context:
space:
mode:
authoryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2012-08-22 15:59:39 (GMT)
committeryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2012-08-22 15:59:39 (GMT)
commit9577c977a90bc85eaa2fe8550202a2cdf15b1e5f (patch)
treea94eca5963ae55f9104c93edbed1f7df439af565 /lz4.c
parentf4e48fe61d37feec8781e7dd51166d827bfe3ea7 (diff)
downloadlz4-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
Diffstat (limited to 'lz4.c')
-rw-r--r--lz4.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lz4.c b/lz4.c
index 8bb7a45..eeefa67 100644
--- a/lz4.c
+++ b/lz4.c
@@ -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;