diff options
author | Nick Terrell <terrelln@fb.com> | 2019-07-17 18:50:47 (GMT) |
---|---|---|
committer | Nick Terrell <terrelln@fb.com> | 2019-07-17 18:50:47 (GMT) |
commit | 13a2d9e34ffc4170720ce417c73e396d0ac1471a (patch) | |
tree | cbc38b9af41d1b2c21c56d019f0daf0f76b1093b /lib/lz4.c | |
parent | 6bc6f836a18d1f8fd05c8fc2b42f1d800bc25de1 (diff) | |
download | lz4-13a2d9e34ffc4170720ce417c73e396d0ac1471a.zip lz4-13a2d9e34ffc4170720ce417c73e396d0ac1471a.tar.gz lz4-13a2d9e34ffc4170720ce417c73e396d0ac1471a.tar.bz2 |
[LZ4_compress_destSize] Fix overflow condition
Diffstat (limited to 'lib/lz4.c')
-rw-r--r-- | lib/lz4.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1027,7 +1027,7 @@ _next_match: } if ((outputDirective) && /* Check output buffer overflow */ - (unlikely(op + (1 + LASTLITERALS) + (matchCode>>8) > olimit)) ) { + (unlikely(op + (1 + LASTLITERALS) + (matchCode+240)/255 > olimit)) ) { if (outputDirective == fillOutput) { /* Match description too long : reduce it */ U32 newMatchCode = 15 /* in token */ - 1 /* to avoid needing a zero byte */ + ((U32)(olimit - op) - 1 - LASTLITERALS) * 255; |