Re: printf %s with NULL pointer (was Re: BUG #17098: Assert failed on composing an error message when adding a type to an extension being dropped)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: printf %s with NULL pointer (was Re: BUG #17098: Assert failed on composing an error message when adding a type to an extension being dropped)
Date: 2021-07-13 15:52:06
Message-ID: 3233754.1626191526@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

I wrote:
> Now, what we don't have control of is what will happen in pre-v12
> branches on platforms where we use the system's *printf. However,
> note what I wrote in the log for 0c62356cc:
> Per commit e748e902d, we appear to have little or no coverage in the
> buildfarm of machines that will dump core when asked to printf a
> null string pointer.
> Thus it appears that a large fraction of the world is already either
> using glibc or following glibc's lead on this point.

Further to that point: I just ran around and verified that the system
printf prints "(null)" rather than crashing on FreeBSD 12.2, NetBSD 8.99,
OpenBSD 6.8, macOS 11.4, and Solaris 11.3. AIX 7.2 and HPUX 10.20 print
"", but still don't crash. If we change snprintf.c then we will also be
okay on Windows, because we've always used our own snprintf on that
platform. In short, the only place I can find where there is actually
any hazard is Solaris 10 [1]. I do not think we should let the risk of
obscure bugs in pre-v12 versions on one obsolete OS drive our
decision-making about this.

regards, tom lane

[1] Per experimentation locally and on the GCC compile farm, using
the attached.

Attachment Content-Type Size
pnull.c text/x-c 118 bytes

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Ranier Vilela 2021-07-13 18:04:19 Re: printf %s with NULL pointer (was Re: BUG #17098: Assert failed on composing an error message when adding a type to an extension being dropped)
Previous Message Tom Lane 2021-07-13 14:29:28 Re: printf %s with NULL pointer (was Re: BUG #17098: Assert failed on composing an error message when adding a type to an extension being dropped)

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-07-13 16:14:03 Re: proposal: possibility to read dumped table's name from file
Previous Message Wu Haotian 2021-07-13 15:45:49 Re: Add option --drop-cascade for pg_dump/restore