From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: kuznetsovam@altlinux.org, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Cc: egori@altlinux.org
Cc: nickel@altlinux.org
Subject: Re: pg_dump: Fix dangling pointer in EndCompressorZstd()
Date: Wed, 16 Apr 2025 19:12:52 -0400
Message-ID: <2085462.1744845172@sss.pgh.pa.us> (raw)
In-Reply-To: <aAAvYUxZW7wibC66@paquier.xyz>
References: <efaee52b-9550-44ca-8633-ea86076b3283@altlinux.org>
<CAExHW5uEAPLhaawqjZOU+yGjS1h8L_U0QGvrx+xA0Y3gF3hdSw@mail.gmail.com>
<E85883B5-DAFA-40B9-9E0A-F2ED6A4144BA@yesql.se>
<aAAvYUxZW7wibC66@paquier.xyz>
Michael Paquier <michael@paquier.xyz> writes:
> On Wed, Apr 16, 2025 at 04:19:02PM +0200, Daniel Gustafsson wrote:
>> Agreed, while it's perfectly safe today the end method should not make
>> assumptions about the use of the private_data pointer upon return and should
>> leave it set to NULL.
> Indeed. I was just looking at applying what Alexander has sent
> because what EndCompressorZstd() not doing what the other methods do
> makes no sense. Perhaps you are already on it, Daniel?
I think the actual reason for the difference is that the methods that
are taking care to zero the pointer do so because they test the
pointer themselves. For instance in EndCompressorGzip, the test is
needed because perhaps no data was sent so the struct never got made.
It incidentally offers protection against a double call of that
function, but I don't think that was the intended reason.
I don't have any big objection to zeroing the pointer in
EndCompressorZstd, but I think the claim that it's precisely
analogous to the other EndCompressor methods is faulty,
because it has no similar test.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, michael@paquier.xyz, daniel@yesql.se, ashutosh.bapat.oss@gmail.com, pgsql-hackers@lists.postgresql.org, egori@altlinux.org, nickel@altlinux.org
Subject: Re: pg_dump: Fix dangling pointer in EndCompressorZstd()
In-Reply-To: <2085462.1744845172@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox