Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qtN5v-00C9Or-TU for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Oct 2023 07:05:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qtN5t-00EiO6-Oy for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Oct 2023 07:05:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qtN5t-00EiNv-GB for pgsql-bugs@lists.postgresql.org; Thu, 19 Oct 2023 07:05:22 +0000 Received: from blue.particules.net ([87.98.130.204] helo=mail.particules.net) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qtN5q-001UoC-5n for pgsql-bugs@lists.postgresql.org; Thu, 19 Oct 2023 07:05:21 +0000 Received: from [192.168.2.100] (unknown [192.168.2.100]) by mail.particules.net (Postfix) with ESMTP id DB55CAA52 for ; Thu, 19 Oct 2023 07:05:17 +0000 (UTC) Content-Type: multipart/alternative; boundary="------------BJqDzPreHac311rWrZ9bbkLi" Message-ID: <1c198c85-92c5-4b2f-bcfb-05376d89ba09@oopacity.net> Date: Thu, 19 Oct 2023 09:05:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Insufficient memory access checks in pglz_decompress Content-Language: fr, en-US To: pgsql-bugs@lists.postgresql.org References: <01fc0593-e31e-463d-902c-dd43174acee2@oopacity.net> <3116807.1697642067@sss.pgh.pa.us> <3235130.1697676483@sss.pgh.pa.us> From: Flavien GUEDEZ In-Reply-To: <3235130.1697676483@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------BJqDzPreHac311rWrZ9bbkLi Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 19/10/2023 à 02:48, Tom Lane a écrit : > I thought of another thing we should change: it's better to perform > the test as "off > (dp - dest)" than the way you formulated it. > "dp - dest" is certainly computable, since it's the number of bytes > we've written to the output buffer so far. But "dp - off" could, > with bad luck and a buffer near the start of memory, wrap around > to look like it's after "dest". > > Pushed with that change and a little fiddling with the comment. > Thanks for the report! > > regards, tom lane Thank you for the details ! Best, Flavien --------------BJqDzPreHac311rWrZ9bbkLi Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Le 19/10/2023 à 02:48, Tom Lane a écrit :
I thought of another thing we should change: it's better to perform
the test as "off > (dp - dest)" than the way you formulated it.
"dp - dest" is certainly computable, since it's the number of bytes
we've written to the output buffer so far.  But "dp - off" could,
with bad luck and a buffer near the start of memory, wrap around
to look like it's after "dest".

Pushed with that change and a little fiddling with the comment.
Thanks for the report!

			regards, tom lane
Thank you for the details !
Best,
Flavien
--------------BJqDzPreHac311rWrZ9bbkLi--