postgresql/src/backend/utils
Nathan Bossart 657e54a058 Detect integer overflow in array_set_slice().
When provided an empty initial array, array_set_slice() fails to
check for overflow when computing the new array's dimensions.
While such overflows are ordinarily caught by ArrayGetNItems(),
commands with the following form are accepted:

	INSERT INTO t (i[-2147483648:2147483647]) VALUES ('{}');

To fix, perform the hazardous computations using overflow-detecting
arithmetic routines.  As with commit 18b585155a, the added test
cases generate errors that include a platform-dependent value, so
we again use psql's VERBOSITY parameter to suppress printing the
message text.

Reported-by: Alexander Lakhin
Author: Joseph Koshakow
Reviewed-by: Jian He
Discussion: https://postgr.es/m/31ad2cd1-db94-bdb3-f91a-65ffdb4bef95%40gmail.com
Backpatch-through: 12
2024-07-23 21:59:02 -05:00
..
activity Use PqMsg_* macros in more places. 2024-07-17 10:51:00 -05:00
adt Detect integer overflow in array_set_slice(). 2024-07-23 21:59:02 -05:00
cache Cope with inplace update making catcache stale during TOAST fetch. 2024-06-27 19:21:06 -07:00
error Avoid crashing when a JIT-inlined backend function throws an error. 2024-06-27 14:44:02 -04:00
fmgr Revise GUC names quoting in messages again 2024-05-17 11:44:26 +02:00
hash Mark hash_corrupted() as pg_attribute_noreturn. 2024-03-17 17:54:45 -04:00
init Increase default vacuum_buffer_usage_limit to 2MB. 2024-04-06 23:12:03 +13:00
mb Make the order of the header file includes consistent 2024-03-13 15:07:00 +01:00
misc Fix bad indentation introduced in 43cd30bcd1 2024-07-15 15:17:37 -07:00
mmgr Fix incorrect sentinel byte logic in GenerationRealloc() 2024-07-06 14:00:06 +12:00
resowner Remove unused typedefs 2024-05-17 07:36:12 +02:00
sort Use bump memory context for tuplesorts 2024-04-08 00:32:26 +12:00
time Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
.gitignore Rearrange makefile rules for running Gen_fmgrtab.pl. 2018-05-03 17:54:18 -04:00
errcodes.txt Introduce transaction_timeout 2024-02-15 23:56:12 +02:00
Gen_dummy_probes.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
Gen_fmgrtab.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
generate-errcodes.pl Update copyright for 2024 2024-01-03 20:49:05 -05:00
Makefile Update copyright for 2024 2024-01-03 20:49:05 -05:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
postprocess_dtrace.sed Update copyright for 2024 2024-01-03 20:49:05 -05:00
probes.d Update copyright for 2024 2024-01-03 20:49:05 -05:00