23 lines
843 B
Diff
23 lines
843 B
Diff
From 13a2d9e34ffc4170720ce417c73e396d0ac1471a Mon Sep 17 00:00:00 2001
|
|
From: Nick Terrell <terrelln@fb.com>
|
|
Date: Wed, 17 Jul 2019 11:50:47 -0700
|
|
Subject: [PATCH] [LZ4_compress_destSize] Fix overflow condition
|
|
|
|
---
|
|
lib/lz4.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/lib/lz4.c b/lib/lz4.c
|
|
index 461644da0..74a9247ec 100644
|
|
--- a/lib/lz4.c
|
|
+++ b/lib/lz4.c
|
|
@@ -1027,7 +1027,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic(
|
|
}
|
|
|
|
if ((outputLimited) && /* Check output buffer overflow */
|
|
- (unlikely(op + (1 + LASTLITERALS) + (matchCode>>8) > olimit)) ) {
|
|
+ (unlikely(op + (1 + LASTLITERALS) + (matchCode+240)/255 > olimit)) ) {
|
|
if (outputLimited == limitedOutput)
|
|
return 0;
|
|
if (outputLimited == fillOutput) {
|