postgresql/src/backend/utils
Tom Lane 1a027e6b7b 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
..
adt Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
cache Fix back-patch of "Avoid race in RelationBuildDesc() ..." 2022-02-09 18:16:56 -08:00
error Log the location field before any backtrace 2020-07-10 08:31:48 +02:00
fmgr Fix broken ruleutils support for function TRANSFORM clauses. 2021-01-25 13:03:11 -05:00
hash Initial pgindent and pgperltidy run for v13. 2020-05-14 13:06:50 -04:00
init Suppress warning about stack_base_ptr with late-model GCC. 2022-02-17 22:45:34 -05:00
mb Dial back -Wimplicit-fallthrough to level 3 2020-05-13 15:31:14 -04:00
misc Set pg_setting.pending_restart when pertinent config lines are removed 2021-07-27 15:44:12 -04:00
mmgr Fix Portal snapshot tracking to handle subtransactions properly. 2021-10-01 11:10:12 -04:00
resowner Improve performance of "simple expressions" in PL/pgSQL. 2020-03-26 18:58:57 -04:00
sort Fix datatype confusion in logtape.c's right_offset(). 2021-12-14 11:46:48 -05:00
time Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
.gitignore Rearrange makefile rules for running Gen_fmgrtab.pl. 2018-05-03 17:54:18 -04:00
errcodes.txt Make SQL/JSON error code names match SQL standard 2020-04-30 09:34:54 +02:00
Gen_dummy_probes.pl Emit dummy statements for probes.d probes when disabled 2021-05-10 13:56:21 +02:00
Gen_dummy_probes.sed Emit dummy statements for probes.d probes when disabled 2021-05-10 13:56:21 +02:00
Gen_fmgrtab.pl Use perl warnings pragma consistently 2020-04-13 11:55:45 -04:00
generate-errcodes.pl Update copyrights for 2020 2020-01-01 12:21:45 -05:00
Makefile Update copyrights for 2020 2020-01-01 12:21:45 -05:00
probes.d Update copyrights for 2020 2020-01-01 12:21:45 -05:00