From: Willy Tarreau <w@1wt.eu>
To: Yueyi Li <liyueyi@live.com>
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 05:08:20 +0100 [thread overview]
Message-ID: <20181128040820.GC19711@1wt.eu> (raw)
In-Reply-To: <BLUPR13MB0289FB16D885625827E8DD27DFD00@BLUPR13MB0289.namprd13.prod.outlook.com>
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))
Could you please recheck ?
Thanks,
Willy
next prev parent reply other threads:[~2018-11-28 4:08 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 [this message]
2018-11-28 6:16 ` Yueyi Li
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=20181128040820.GC19711@1wt.eu \
--to=w@1wt.eu \
--cc=donb@securitymouse.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liyueyi@live.com \
/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).