commit 9b97c3a72a0ef1b66e0326d180fa0b29fc9c2094 Author: l30004689 Date: Fri Jun 11 03:01:43 2021 -0400 [Backport]Fix potential memory corruption with negative memmove() size Offering: GaussDB Kernel CVE: CVE-2021-3520 Reference: https://github.com/lz4/lz4/commit/8301a21773ef61656225e264f4f06ae14462bca7 Signed-off-by: liuqirun liuqirun@huawei.com diff --git a/lib/lz4.c b/lib/lz4.c index 9808d70..805388d 100644 --- a/lib/lz4.c +++ b/lib/lz4.c @@ -1665,7 +1665,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;