linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yueyi Li <liyueyi@live.com>
To: Willy Tarreau <w@1wt.eu>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"donb@securitymouse.com" <donb@securitymouse.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lzo: fix ip overrun during compress.
Date: Wed, 28 Nov 2018 06:16:10 +0000	[thread overview]
Message-ID: <BLUPR13MB0289DF5EA12E2D27D7908CF7DFD10@BLUPR13MB0289.namprd13.prod.outlook.com> (raw)
In-Reply-To: <20181128040820.GC19711@1wt.eu>

Hi Willy,


On 2018/11/28 12:08, Willy Tarreau wrote:
> Hi Yueyi,
>
> On Tue, Nov 27, 2018 at 10:34:26AM +0000, Yueyi Li wrote:
>> It`s possible ip overrun in lzo1x_1_do_compress() when compressed page is
>> point to the end of memory and which virtual address is 0xfffffffffffff000.
>> Leading to a NULL pointer access during the get_unaligned_le32(ip).
> Thanks for this report.
>
> (...)
>> diff --git a/lib/lzo/lzo1x_compress.c b/lib/lzo/lzo1x_compress.c
>> index 236eb21..a0265a6 100644
>> --- a/lib/lzo/lzo1x_compress.c
>> +++ b/lib/lzo/lzo1x_compress.c
>> @@ -17,6 +17,9 @@
>>   #include <linux/lzo.h>
>>   #include "lzodefs.h"
>>   
>> +#define OVERFLOW_ADD_CHECK(a, b)  \
>> +	((size_t)~0 - (size_t)(a) < (size_t)(b) ? true : false)
>> +
> I think the test would be easier to grasp this way :
>
> #define OVERFLOW_ADD_CHECK(a, b)  \
> 	((size_t)(b) >= (size_t)((void*)0 - (void *)(a)))
>
> But the following should be more efficient since we build with
> -fno-strict-overflow :
>
> #define OVERFLOW_ADD_CHECK(a, b)  \
> 	(((a) + (b)) < (a))
Thanks for the suggestion,  I will change it in next version.
> Could you please recheck ?
>
> Thanks,
> Willy

Thanks,
Yueyi

      reply	other threads:[~2018-11-28  6:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27 10:34 [PATCH] lzo: fix ip overrun during compress Yueyi Li
2018-11-28  4:08 ` Willy Tarreau
2018-11-28  6:16   ` Yueyi Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BLUPR13MB0289DF5EA12E2D27D7908CF7DFD10@BLUPR13MB0289.namprd13.prod.outlook.com \
    --to=liyueyi@live.com \
    --cc=donb@securitymouse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).