postgresql/src/test/regress
Tom Lane edc0a8d82a Detect integer overflow while computing new array dimensions.
array_set_element() and related functions allow an array to be
enlarged by assigning to subscripts outside the current array bounds.
While these places were careful to check that the new bounds are
allowable, they neglected to consider the risk of integer overflow
in computing the new bounds.  In edge cases, we could compute new
bounds that are invalid but get past the subsequent checks,
allowing bad things to happen.  Memory stomps that are potentially
exploitable for arbitrary code execution are possible, and so is
disclosure of server memory.

To fix, perform the hazardous computations using overflow-detecting
arithmetic routines, which fortunately exist in all still-supported
branches.

The test cases added for this generate (after patching) errors that
mention the value of MaxArraySize, which is platform-dependent.
Rather than introduce multiple expected-files, use psql's VERBOSITY
parameter to suppress the printing of the message text.  v11 psql
lacks that parameter, so omit the tests in that branch.

Our thanks to Pedro Gallegos for reporting this problem.

Security: CVE-2023-5869
2023-11-06 10:56:43 -05:00
..
data Fix full text search to handle NOT above a phrase search correctly. 2020-04-27 12:21:04 -04:00
expected Detect integer overflow while computing new array dimensions. 2023-11-06 10:56:43 -05:00
input Choose FK name correctly during partition attachment 2022-09-08 13:17:02 +02:00
output Choose FK name correctly during partition attachment 2022-09-08 13:17:02 +02:00
sql Detect integer overflow while computing new array dimensions. 2023-11-06 10:56:43 -05:00
.gitignore Fix inconsistencies and typos in the tree, take 10 2019-08-13 13:53:41 +09:00
GNUmakefile Avoid creating testtablespace directories where not wanted. 2021-05-19 14:04:01 -04:00
Makefile Fix non-GNU makefiles for AIX make. 2017-11-30 00:57:22 -08:00
README
parallel_schedule Fix crashes with CREATE SCHEMA AUTHORIZATION and schema elements 2023-04-28 19:29:38 +09:00
pg_regress.c Make EXEC_BACKEND more convenient on Linux and FreeBSD. 2023-02-08 13:09:27 +09:00
pg_regress.h Allow pg_regress.c wrappers to postprocess test result files. 2021-01-11 13:43:19 -05:00
pg_regress_main.c Allow configurable LZ4 TOAST compression. 2021-03-19 15:10:38 -04:00
regress.c Initial pgindent and pgperltidy run for v14. 2021-05-12 13:14:10 -04:00
regressplans.sh Fix inconsistencies in the code 2019-07-08 13:15:09 +09:00
resultmap Cygwin and Mingw floating-point fixes. 2019-02-16 01:50:16 +00:00
standby_schedule

README

Documentation concerning how to run these regression tests and interpret
the results can be found in the PostgreSQL manual, in the chapter
"Regression Tests".