pgsql: Disallow NaN as a value for floating-point GUCs.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Disallow NaN as a value for floating-point GUCs.
Date: 2019-03-10 16:59:39
Message-ID: E1h31nX-0006xD-T8@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Disallow NaN as a value for floating-point GUCs.

None of the code that uses GUC values is really prepared for them to
hold NaN, but parse_real() didn't have any defense against accepting
such a value. Treat it the same as a syntax error.

I haven't attempted to analyze the exact consequences of setting any
of the float GUCs to NaN, but since they're quite unlikely to be good,
this seems like a back-patchable bug fix.

Note: we don't need an explicit test for +-Infinity because those will
be rejected by existing range checks. I added a regression test for
that in HEAD, but not older branches because the spelling of the value
in the error message will be platform-dependent in branches where we
don't always use port/snprintf.c.

Discussion: https://postgr.es/m/1798.1552165479@sss.pgh.pa.us

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5aafedc2fdbdbe4efcb749b0f20a925436d18d06

Modified Files
--------------
src/backend/utils/misc/guc.c | 4 ++++
src/test/regress/expected/guc.out | 5 +++++
src/test/regress/sql/guc.sql | 4 ++++
3 files changed, 13 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2019-03-10 19:18:20 pgsql: Include GUC's unit, if it has one, in out-of-range error message
Previous Message Alvaro Herrera 2019-03-10 16:26:26 pgsql: pg_upgrade: Ignore TOAST for partitioned tables