]> 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:54:13 +0000 (17:54 -0400)
commit6d10f4e9d7f0051afb60c42409f2fe61cf4da348
tree4db7a8ed0088b5d6614caab678d54737661a50f5
parentd8f15c95bec50f552ad0b13ea6eafb6975126184
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