summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <Cyan4973@users.noreply.github.com>2018-04-24 18:25:57 (GMT)
committerGitHub <noreply@github.com>2018-04-24 18:25:57 (GMT)
commit8c6ca6283d00d1882cfa18e6477b51c9d7e74ed4 (patch)
treec67b0e623482e4d22786ded1bdabd82c01e9bbf6 /lib
parent092cb775974218df96e8243957c182d685c81278 (diff)
parent44bff3fd3b4fc6280cad3f8b930d6a404e3bb236 (diff)
downloadlz4-8c6ca6283d00d1882cfa18e6477b51c9d7e74ed4.zip
lz4-8c6ca6283d00d1882cfa18e6477b51c9d7e74ed4.tar.gz
lz4-8c6ca6283d00d1882cfa18e6477b51c9d7e74ed4.tar.bz2
Merge pull request #511 from lz4/decFast
Fixed performance issue with LZ4_decompress_fast()
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile1
-rw-r--r--lib/lz4.c8
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/Makefile b/lib/Makefile
index d6a8625..bb45582 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -186,6 +186,7 @@ uninstall:
@$(RM) $(DESTDIR)$(INCLUDEDIR)/lz4.h
@$(RM) $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
@$(RM) $(DESTDIR)$(INCLUDEDIR)/lz4frame.h
+ @$(RM) $(DESTDIR)$(INCLUDEDIR)/lz4frame_static.h
@echo lz4 libraries successfully uninstalled
endif
diff --git a/lib/lz4.c b/lib/lz4.c
index f32106c..eaabe5b 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1542,9 +1542,11 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
* this shortcut was tested on x86 and x64, where it improves decoding speed.
* it has not yet been benchmarked on ARM, Power, mips, etc.
* NOTE: The loop begins with a read, so we must have one byte left at the end. */
- if (((ip + 14 /*maxLL*/ + 2 /*offset*/ < iend)
- & (op + 14 /*maxLL*/ + 18 /*maxML*/ <= oend))
- & ((token < (15<<ML_BITS)) & ((token & ML_MASK) != 15)) ) {
+ if (endOnInput
+ && ((ip + 14 /*maxLL*/ + 2 /*offset*/ < iend)
+ & (op + 14 /*maxLL*/ + 18 /*maxML*/ <= oend)
+ & (token < (15<<ML_BITS))
+ & ((token & ML_MASK) != 15) ) ) {
size_t const ll = token >> ML_BITS;
size_t const off = LZ4_readLE16(ip+ll);
const BYTE* const matchPtr = op + ll - off; /* pointer underflow risk ? */