postgresql/src/test
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
..
authentication Add missing $Test::Builder::Level settings 2021-09-23 23:06:55 +02:00
examples libpq: Remove deprecated connection parameters authtype and tty 2021-03-09 15:01:22 +01:00
isolation Remove test from commit fa2e874946. 2023-08-10 10:26:12 -07:00
kerberos Adjust kerberos and ldap tests for Homebrew on ARM 2023-07-04 11:14:53 +02:00
ldap Adjust kerberos and ldap tests for Homebrew on ARM 2023-07-04 11:14:53 +02:00
locale Remove extraneous newlines added by perl copyright patch 2021-05-07 11:37:37 -04:00
mb Fix MB regression tests for WAL-logging of hash indexes. 2017-03-15 07:25:36 -04:00
modules Reject substituting extension schemas or owners matching ["$'\]. 2023-08-07 06:06:00 -07:00
perl Don't trust unvalidated xl_tot_len. 2023-09-23 10:28:40 +12:00
recovery Fix edge-case for xl_tot_len broken by bae868ca. 2023-09-26 10:54:24 +13:00
regress Detect integer overflow while computing new array dimensions. 2023-11-06 10:56:43 -05:00
ssl Fix failures in SSL tests caused by out-of-tree keys and certificates 2022-03-22 13:21:33 +09:00
subscription Ignore generated columns during apply of update/delete. 2023-03-23 11:32:22 +05:30
Makefile Revert per-index collation version tracking feature. 2021-05-07 21:10:11 +12:00
README Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00

README

PostgreSQL tests
================

This directory contains a variety of test infrastructure as well as some of the
tests in PostgreSQL. Not all tests are here -- in particular, there are more in
individual contrib/ modules and in src/bin.

Not all these tests get run by "make check". Check src/test/Makefile to see
which tests get run automatically.

authentication/
  Tests for authentication (but see also below)

examples/
  Demonstration programs for libpq that double as regression tests via
  "make check"

isolation/
  Tests for concurrent behavior at the SQL level

kerberos/
  Tests for Kerberos/GSSAPI authentication and encryption

ldap/
  Tests for LDAP-based authentication

locale/
  Sanity checks for locale data, encodings, etc

mb/
  Tests for multibyte encoding (UTF-8) support

modules/
  Extensions used only or mainly for test purposes, generally not suitable
  for installing in production databases

perl/
  Infrastructure for Perl-based TAP tests

recovery/
  Test suite for recovery and replication

regress/
  PostgreSQL's main regression test suite, pg_regress

ssl/
  Tests to exercise and verify SSL certificate handling

subscription/
  Tests for logical replication