summaryrefslogtreecommitdiffstats
path: root/lib/lz4/lz4_decompress.c
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2022-04-15 09:26:00 +0200
committerPaolo Abeni <pabeni@redhat.com>2022-04-15 09:26:00 +0200
commitedf45f007a31e86738f6be3065591ddad94477d1 (patch)
tree2805eeead7a03344a2b1185314d791a65fe15dc1 /lib/lz4/lz4_decompress.c
parentMerge branch 'rndis_host-handle-bogus-mac-addresses-in-zte-rndis-devices' (diff)
parentMerge tag 'net-5.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/net... (diff)
downloadlinux-edf45f007a31e86738f6be3065591ddad94477d1.tar.xz
linux-edf45f007a31e86738f6be3065591ddad94477d1.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Diffstat (limited to 'lib/lz4/lz4_decompress.c')
-rw-r--r--lib/lz4/lz4_decompress.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
index 926f4823d5ea..fd1728d94bab 100644
--- a/lib/lz4/lz4_decompress.c
+++ b/lib/lz4/lz4_decompress.c
@@ -271,8 +271,12 @@ static FORCE_INLINE int LZ4_decompress_generic(
ip += length;
op += length;
- /* Necessarily EOF, due to parsing restrictions */
- if (!partialDecoding || (cpy == oend))
+ /* Necessarily EOF when !partialDecoding.
+ * When partialDecoding, it is EOF if we've either
+ * filled the output buffer or
+ * can't proceed with reading an offset for following match.
+ */
+ if (!partialDecoding || (cpy == oend) || (ip >= (iend - 2)))
break;
} else {
/* may overwrite up to WILDCOPYLENGTH beyond cpy */