postgresql/src/backend/utils
Tom Lane 0a52d378b0 Avoid passing NULL to memcmp() in lookups of zero-argument functions.
A few places assumed they could pass NULL for the argtypes array when
looking up functions known to have zero arguments.  At first glance
it seems that this should be safe enough, since memcmp() is surely not
allowed to fetch any bytes if its count argument is zero.  However,
close reading of the C standard says that such calls have undefined
behavior, so we'd probably best avoid it.

Since the number of places doing this is quite small, and some other
places looking up zero-argument functions were already passing dummy
arrays, let's standardize on the latter solution rather than hacking
the function lookup code to avoid calling memcmp() in these cases.
I also added Asserts to catch any future violations of the new rule.

Given the utter lack of any evidence that this actually causes any
problems in the field, I don't feel a need to back-patch this change.

Per report from Piotr Stefaniak, though this is not his patch.
2015-06-27 17:47:39 -04:00
..
adt Avoid passing NULL to memcmp() in lookups of zero-argument functions. 2015-06-27 17:47:39 -04:00
cache Fix the logic for putting relations into the relcache init file. 2015-06-25 14:39:05 -04:00
error pgindent run for 9.5 2015-05-23 21:35:49 -04:00
fmgr pgindent run for 9.5 2015-05-23 21:35:49 -04:00
hash Reorganize our CRC source files again. 2015-04-14 17:03:42 +03:00
init Allow background workers to connect to no particular database. 2015-06-25 15:52:13 -04:00
mb Remove no-longer-required function declarations. 2015-05-24 12:20:23 -04:00
misc Fix alphabetization in catalogs.sgml. 2015-06-12 12:59:29 +09:00
mmgr Support "expanded" objects, particularly arrays, for better performance. 2015-05-14 12:08:49 -04:00
resowner Update copyright for 2015 2015-01-06 11:43:47 -05:00
sort pgindent run for 9.5 2015-05-23 21:35:49 -04:00
time pgindent run for 9.5 2015-05-23 21:35:49 -04:00
.gitignore Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
errcodes.txt Change SQLSTATE for event triggers "wrong context" message 2015-04-08 15:26:50 -03:00
Gen_dummy_probes.sed Update copyright for 2015 2015-01-06 11:43:47 -05:00
Gen_fmgrtab.pl Allow forcing nullness of columns during bootstrap. 2015-02-21 22:31:54 +01:00
generate-errcodes.pl Update copyright for 2015 2015-01-06 11:43:47 -05:00
Makefile Make handling of errcodes.h more consistent with other generated headers. 2011-02-04 09:29:10 -05:00
probes.d Update copyright for 2015 2015-01-06 11:43:47 -05:00