postgresql/src
Tom Lane c25a929a6c Fix JSON error reporting for many cases of erroneous string values.
The majority of error exit cases in json_lex_string() failed to
set lex->token_terminator, causing problems for the error context
reporting code: it would see token_terminator less than token_start
and do something more or less nuts.  In v14 and up the end result
could be as bad as a crash in report_json_context().  Older
versions accidentally avoided that fate; but all versions produce
error context lines that are far less useful than intended,
because they'd stop at the end of the prior token instead of
continuing to where the actually-bad input is.

To fix, invent some macros that make it less notationally painful
to do the right thing.  Also add documentation about what the
function is actually required to do; and in >= v14, add an assertion
in report_json_context about token_terminator being sufficiently
far advanced.

Per report from Nikolay Shaplov.  Back-patch to all supported
versions.

Discussion: https://postgr.es/m/7332649.x5DLKWyVIX@thinkpad-pgpro
2023-03-13 15:19:00 -04:00
..
backend Fix JSON error reporting for many cases of erroneous string values. 2023-03-13 15:19:00 -04:00
bin Make EXEC_BACKEND more convenient on Linux and FreeBSD. 2023-02-08 13:09:52 +09:00
common Make EXEC_BACKEND more convenient on Linux and FreeBSD. 2023-02-08 13:09:52 +09:00
fe_utils Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
include Fix MULTIEXPR_SUBLINK with partitioned target tables, yet again. 2023-02-25 14:44:14 -05:00
interfaces Fix inconsistent error handling for GSS encryption in PQconnectPoll() 2023-03-13 16:36:34 +09:00
makefiles Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:35 -04:00
pl Translation updates 2023-02-06 12:21:32 +01:00
port Stamp 12.14. 2023-02-06 16:45:00 -05:00
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:29:13 -04:00
test Fix JSON error reporting for many cases of erroneous string values. 2023-03-13 15:19:00 -04:00
timezone Update time zone data files to tzdata release 2022g. 2023-01-31 17:37:28 -05:00
tools Don't force SQL_ASCII/no-locale for installcheck in vcregress.pl 2023-02-26 06:52:09 -05:00
tutorial Doc: sync src/tutorial/basics.source with SGML documentation. 2022-11-19 13:09:14 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Prevent port collisions between concurrent TAP tests 2022-11-22 10:52:42 -05:00
Makefile.shlib Fix pkg-config files for static linking 2021-09-06 09:43:18 +02:00
nls-global.mk NLS: Fix backend gettext triggers 2019-09-23 09:05:50 +02:00