diff options
author | Nathan Bossart <nathan@postgresql.org> | 2024-07-23 21:59:02 -0500 |
---|---|---|
committer | Nathan Bossart <nathan@postgresql.org> | 2024-07-23 21:59:02 -0500 |
commit | 547dd2cbda12a7316c796999d24e6b3a4338e4a6 (patch) | |
tree | d3aac227739a58c01de2650c605268cef4c165c9 /src/backend/tcop/postgres.c | |
parent | 9aa644f92959eca29680595e725a6e71b273f08d (diff) | |
download | postgresql-547dd2cbda12a7316c796999d24e6b3a4338e4a6.tar.gz postgresql-547dd2cbda12a7316c796999d24e6b3a4338e4a6.zip |
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
Diffstat (limited to 'src/backend/tcop/postgres.c')
0 files changed, 0 insertions, 0 deletions