[PATCH] Fix potential memory corruption with negative memmove() size
authorJasper Lievisse Adriaanse <j@jasper.la>
Fri, 26 Feb 2021 14:21:20 +0000 (15:21 +0100)
committerNobuhiro Iwamatsu <iwamatsu@debian.org>
Wed, 5 May 2021 07:29:57 +0000 (08:29 +0100)
Gbp-Pq: Name 0005-CVE-2021-3520.patch

lib/lz4.c

index 9f5e9bfa0839f8e1347d2abb3d867b21ff740215..eac0541b22a0053d111c05a345c43e93cd8a5e85 100644 (file)
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1749,7 +1749,7 @@ LZ4_decompress_generic(
                  const size_t dictSize         /* note : = 0 if noDict */
                  )
 {
-    if (src == NULL) { return -1; }
+    if ((src == NULL) || (outputSize < 0)) { return -1; }
 
     {   const BYTE* ip = (const BYTE*) src;
         const BYTE* const iend = ip + srcSize;