postgresql/src
David Rowley b76fb6c2a9 Temporarily make MemoryContextContains return false
5265e91fd changed MemoryContextContains to update it so that it works
correctly with the new MemoryChunk code added in c6e0fe1f2.  However,
5265e91fd was done with the assumption that MemoryContextContains would
only ever be given pointers to memory that had been returned by one of our
MemoryContext allocators.  It seems that's not true and many of our 32-bit
buildfarm animals are clearly showing that.

There are some code paths that call MemoryContextContains with a pointer
pointing part way into an allocated chunk.  The example of this found by
the 32-bit buildfarm animals is the int2int4_sum() function.  This
function returns transdata->sum, which is not a pointer to memory that was
allocated directly.  This return value is then subsequently passed to
MemoryContextContains which causes it to crash due to it thinking the
memory directly prior to that pointer is a MemoryChunk.  What's actually
in that memory is the field in the struct that comes prior to the "sum"
field.  This problem didn't occur in 64-bit world because BIGINT is a
byval type and the code which was calling MemoryContextContains with the
bad pointer only does so with non-byval types.

Here, instead of reverting 5265e91fd and making MemoryContextContains
completely broken again, let's just make it always return false for now.
Effectively prior to 5265e91fd it was doing that anyway, this at least
makes that more explicit.  The only repercussions of this with the current
MemoryContextContains calls are that we perform a datumCopy() when we
might not need to.  This should make the 32-bit buildfarm animals happy
again and give us more time to consider a long-term fix.

Discussion: https://postgr.es/m/20220907130552.sfjri7jublfxyyi4%40jrouhaud
2022-09-09 00:28:38 +12:00
..
backend Temporarily make MemoryContextContains return false 2022-09-09 00:28:38 +12:00
bin Add psql tab compression for SET COMPRESSION with ALTER TABLE 2022-09-06 15:36:42 +09:00
common Speed up lexing of long JSON strings 2022-09-02 09:36:22 +07:00
fe_utils Clean up inconsistent use of fflush(). 2022-08-29 13:55:41 -04:00
include Fix recovery_prefetch with low maintenance_io_concurrency. 2022-09-08 21:44:55 +12:00
interfaces Revert SQL/JSON features 2022-09-01 17:07:14 -04:00
makefiles aix: when building with gcc, tell gcc we're building a shared library 2022-09-01 11:49:36 -07:00
pl Fix incorrect uses of Datum conversion macros 2022-09-05 13:30:44 +02:00
port Cleanup more code and comments related to Windows NT4 (XP days) 2022-08-30 09:52:58 +09:00
template Move darwin sysroot determination into separate file 2022-09-01 16:54:19 -07:00
test Choose FK name correctly during partition attachment 2022-09-08 13:17:02 +02:00
timezone Expand the use of get_dirent_type(), shaving a few calls to stat()/lstat() 2022-09-02 16:58:06 +09:00
tools Fix cplusplusscheck in vpath builds 2022-09-06 13:51:15 +07:00
tutorial Update copyright for 2022 2022-01-07 19:04:57 -05:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Remove unused configure variable. 2022-08-18 11:22:13 -04:00
Makefile.shlib aix: Fix SHLIB_EXPORTS reference in VPATH builds 2022-08-24 20:39:46 -07:00
nls-global.mk Fix for make unportability 2022-07-13 09:15:01 +02:00