]> granicus.if.org Git - postgresql/commit
Only adjust negative indexes in json_get up to the length of the path.
authorAndrew Dunstan <andrew@dunslane.net>
Tue, 28 Jul 2015 21:54:13 +0000 (17:54 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Tue, 28 Jul 2015 21:59:13 +0000 (17:59 -0400)
commit40a50a17b905dae233ddb8bb36b7deff9e3abb16
tree2faf357d77851302f7b87cd29d5ee1e10dbd7a79
parent116be6c17102a4b300037d3c565694cac0bcba90
Only adjust negative indexes in json_get up to the length of the path.

The previous code resulted in memory access beyond the path bounds. The
cure is to move it into a code branch that checks the value of lex_level
is within the correct bounds.

Bug reported and diagnosed by Piotr Stefaniak.
src/backend/utils/adt/jsonfuncs.c