pgsql: Fix "path" infrastructure bug affecting jsonb_set()

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix "path" infrastructure bug affecting jsonb_set()
Date: 2015-06-12 23:27:10
Message-ID: E1Z3YLu-00024G-Ti@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix "path" infrastructure bug affecting jsonb_set()

jsonb_set() and other clients of the setPathArray() utility function
could get spurious results when an array integer subscript is provided
that is not within the range of int.

To fix, ensure that the value returned by strtol() within setPathArray()
is within the range of int; when it isn't, assume an invalid input in
line with existing, similar cases. The path-orientated operators that
appeared in PostgreSQL 9.3 and 9.4 do not call setPathArray(), and
already independently take this precaution, so no change there.

Peter Geoghegan

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/2271d002d5c305441398e8f7a295f18ec3c132a9

Modified Files
--------------
src/backend/utils/adt/jsonfuncs.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2015-06-13 01:48:06 pgsql: release notes: add two optimizer items
Previous Message Tom Lane 2015-06-12 17:44:13 pgsql: Fix failure to cover scalar-vs-rowtype cases in exec_stmt_return