pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Andreas Seltenreich <seltenreich@gmx.de>
Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Subject: Re: [sqlsmith] Crash on GUC serialization
Date: Sat, 19 Nov 2016 13:40:53 -0500
Message-ID: <5483.1479580853@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB7nPqRdpG_WuVTwpp6=b0wEDPki7hPX+iLwKf9e4Q-iEj0APQ@mail.gmail.com>
References: <871sy78wno.fsf@credativ.de>
	<2655.1479576672@sss.pgh.pa.us>
	<CAB7nPqRdpG_WuVTwpp6=b0wEDPki7hPX+iLwKf9e4Q-iEj0APQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Michael Paquier <michael.paquier@gmail.com> writes:
> On Sat, Nov 19, 2016 at 9:31 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Thanks for the report!  Looks like the serialization code has overlooked
>> the fact that string-valued GUCs can be NULL.  Surprising we didn't
>> find that before ...

> I was half-way through it when you sent your email. It seems to me
> that we need to take care only of the case for PGC_STRING, per the
> attached.

Meh; that might be stopping the crash for you but you didn't consider what
to do in serialize_variable.  Some machines would dump core there instead,
and others would print "(null)" which wouldn't fit in the allocated space.

The bigger problem here is that set_config_option cannot be used to set
a string GUC's value to NULL --- it will treat value == NULL as a request
to set to the reset_val.  The best we can do is to convert the value
into an empty string, which isn't quite the same thing, though it may be
close enough (compare e45e990e4).

I'm also pretty unexcited about serializing float variables this way ---
assuming that sprintf("%.17g") will reconstruct doubles exactly is
just asking for trouble IMO.

So I can't escape the itchy feeling that this entire chunk of code
needs to be thrown away and rewritten differently.  But it'd take
some refactoring of the code under set_config_option to do it nicely,
which is more work than we probably want to put in now.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (8+ messages)  latest in thread

Message-ID: <5483.1479580853@sss.pgh.pa.us>
Permalink:  ../5483.1479580853@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5483.1479580853@sss.pgh.pa.us

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, michael.paquier@gmail.com, seltenreich@gmx.de
  Subject: Re: [sqlsmith] Crash on GUC serialization
  In-Reply-To: <5483.1479580853@sss.pgh.pa.us>
  References: <871sy78wno.fsf@credativ.de> <2655.1479576672@sss.pgh.pa.us> <CAB7nPqRdpG_WuVTwpp6=b0wEDPki7hPX+iLwKf9e4Q-iEj0APQ@mail.gmail.com> <5483.1479580853@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