summaryrefslogtreecommitdiff
path: root/lz4/lz4-1.9.3-negative-memmove.patch
blob: 053958dfe872769a3fd906ae1f764e97a2125cce (plain)
    1 From 8301a21773ef61656225e264f4f06ae14462bca7 Mon Sep 17 00:00:00 2001
    2 From: Jasper Lievisse Adriaanse <j@jasper.la>
    3 Date: Fri, 26 Feb 2021 15:21:20 +0100
    4 Subject: [PATCH] Fix potential memory corruption with negative memmove() size
    5 
    6 ---
    7  lib/lz4.c | 2 +-
    8  1 file changed, 1 insertion(+), 1 deletion(-)
    9 
   10 diff --git a/lib/lz4.c b/lib/lz4.c
   11 index 5f524d01d..c2f504ef3 100644
   12 --- a/lib/lz4.c
   13 +++ b/lib/lz4.c
   14 @@ -1749,7 +1749,7 @@ LZ4_decompress_generic(
   15                   const size_t dictSize         /* note : = 0 if noDict */
   16                   )
   17  {
   18 -    if (src == NULL) { return -1; }
   19 +    if ((src == NULL) || (outputSize < 0)) { return -1; }
   20  
   21      {   const BYTE* ip = (const BYTE*) src;
   22          const BYTE* const iend = ip + srcSize;

Generated by cgit