postgresql/src/backend
Tom Lane 46ab07ffda Clean up assorted failures under clang's -fsanitize=undefined checks.
Most of these are cases where we could call memcpy() or other libc
functions with a NULL pointer and a zero count, which is forbidden
by POSIX even though every production version of libc allows it.
We've fixed such things before in a piecemeal way, but apparently
never made an effort to try to get them all.  I don't claim that
this patch does so either, but it gets every failure I observe in
check-world, using clang 12.0.1 on current RHEL8.

numeric.c has a different issue that the sanitizer doesn't like:
"ln(-1.0)" will compute log10(0) and then try to assign the
resulting -Inf to an integer variable.  We don't actually use the
result in such a case, so there's no live bug.

Back-patch to all supported branches, with the idea that we might
start running a buildfarm member that tests this case.  This includes
back-patching c1132aae3 (Check the size in COPY_POINTER_FIELD),
which previously silenced some of these issues in copyfuncs.c.

Discussion: https://postgr.es/m/CALNJ-vT9r0DSsAOw9OXVJFxLENoVS_68kJ5x0p44atoYH+H4dg@mail.gmail.com
2022-03-03 18:13:24 -05:00
..
access Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
bootstrap pg_upgrade: Preserve relfilenodes and tablespace OIDs. 2022-01-17 13:40:27 -05:00
catalog Fix catalog data of pg_stop_backup(), labelled v2 2022-03-03 10:51:57 +09:00
commands Clean up and simplify code in a couple of set-returning functions 2022-02-24 16:11:34 +09:00
executor Don't use static storage for SaveTransactionCharacteristics(). 2022-02-28 12:54:12 -05:00
foreign Clean up and simplify code in a couple of set-returning functions 2022-02-24 16:11:34 +09:00
jit Track LLVM 15 changes. 2022-02-14 15:51:43 +13:00
lib Update copyright for 2022 2022-01-07 19:04:57 -05:00
libpq Allow root-owned SSL private keys in libpq, not only the backend. 2022-02-28 14:12:52 -05:00
main windows: Improve crash / assert / exception handling. 2022-02-02 18:33:25 -08:00
nodes Allow specifying row filters for logical replication of tables. 2022-02-22 08:11:50 +05:30
optimizer Don't use_physical_tlist for an IOS with non-returnable columns. 2022-02-11 15:24:02 -05:00
parser Allow specifying row filters for logical replication of tables. 2022-02-22 08:11:50 +05:30
partitioning Fix misuse of "const" qualifier. 2022-02-13 19:20:56 -05:00
po Translation updates 2021-06-21 12:33:50 +02:00
port Ensure that the argument of shmdt(2) is declared "void *". 2022-02-15 17:17:28 -05:00
postmaster Reconsider pg_stat_subscription_workers view. 2022-03-01 06:17:52 +05:30
regex Call pg_newlocale_from_collation() also with default collation 2022-01-20 09:50:18 +01:00
replication Reconsider pg_stat_subscription_workers view. 2022-03-01 06:17:52 +05:30
rewrite Update copyright for 2022 2022-01-07 19:04:57 -05:00
snowball Update copyright for 2022 2022-01-07 19:04:57 -05:00
statistics Fix various typos, grammar and code style in comments and docs 2022-01-25 09:40:04 +09:00
storage Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
tcop Fix SPI's handling of errors during transaction commit. 2022-02-28 12:45:36 -05:00
tsearch Update copyright for 2022 2022-01-07 19:04:57 -05:00
utils Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Server-side gzip compression. 2022-01-24 15:13:18 -05:00
nls.mk Report progress of startup operations that take a long time. 2021-10-25 11:51:57 -04:00