pgsql: Fix IsValidJsonNumber() to notice trailing non-alphanumeric garb - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix IsValidJsonNumber() to notice trailing non-alphanumeric garb
Date
Msg-id E1aQr6n-00077k-BZ@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix IsValidJsonNumber() to notice trailing non-alphanumeric garbage.

Commit e09996ff8dee3f70 was one brick shy of a load: it didn't insist
that the detected JSON number be the whole of the supplied string.
This allowed inputs such as "2016-01-01" to be misdetected as valid JSON
numbers.  Per bug #13906 from Dmitry Ryabov.

In passing, be more wary of zero-length input (I'm not sure this can
happen given current callers, but better safe than sorry), and do some
minor cosmetic cleanup.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/aa223a037be2935dd6e335d94550dc3f53262479

Modified Files
--------------
contrib/hstore/expected/hstore.out | 16 ++++++------
contrib/hstore/sql/hstore.sql      |  4 +--
src/backend/utils/adt/json.c       | 52 ++++++++++++++++++++++++--------------
3 files changed, 43 insertions(+), 29 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix IsValidJsonNumber() to notice trailing non-alphanumeric garb
Next
From: Tom Lane
Date:
Subject: pgsql: Fix IsValidJsonNumber() to notice trailing non-alphanumeric garb