postgresql/src/backend
Thomas Munro 29ddb548f6 Fix inconsistent out-of-memory error reporting in dsa.c.
Commit 16be2fd1 introduced the flag DSA_ALLOC_NO_OOM to control whether
the DSA allocator would raise an error or return InvalidDsaPointer on
failure to allocate.  One edge case was not handled correctly: if we
fail to allocate an internal "span" object for a large allocation, we
would always return InvalidDsaPointer regardless of the flag; a caller
not expecting that could then dereference a null pointer.

This is a plausible explanation for a one-off report of a segfault.

Remove a redundant pair of braces so that all three stanzas that handle
DSA_ALLOC_NO_OOM match in style, for visual consistency.

While fixing inconsistencies, if FreePageManagerGet() can't supply the
pages that our book-keeping says it should be able to supply, then we
should always report a FATAL error.  Previously we treated that as a
regular allocation failure in one code path, but as a FATAL condition
in another.

Back-patch to 10, where dsa.c landed.

Author: Thomas Munro
Reported-by: Jakub Glapa
Discussion: https://postgr.es/m/CAEepm=2oPqXxyWQ-1o60tpOLrwkw=VpgNXqqF1VN2EyO9zKGQw@mail.gmail.com
2019-02-25 11:11:40 +13:00
..
access Fix incorrect function reference in comment of twophase.c 2019-02-23 08:40:01 +09:00
bootstrap Remove argument isprimary from index_build() 2019-01-24 07:57:09 +09:00
catalog Move code for managing PartitionDescs into a new file, partdesc.c 2019-02-21 11:45:02 -05:00
commands Move code for managing PartitionDescs into a new file, partdesc.c 2019-02-21 11:45:02 -05:00
executor Move code for managing PartitionDescs into a new file, partdesc.c 2019-02-21 11:45:02 -05:00
foreign Update copyright for 2019 2019-01-02 12:44:25 -05:00
jit Renaming for new subscripting mechanism 2019-02-01 12:50:32 -03:00
lib Make use of compiler builtins and/or assembly for CLZ, CTZ, POPCNT. 2019-02-15 23:22:33 -05:00
libpq Get rid of another unconstify through API changes 2019-02-14 20:44:47 +01:00
main Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00
nodes Allow user control of CTE materialization, and change the default behavior. 2019-02-16 16:11:12 -05:00
optimizer Fix plan created for inherited UPDATE/DELETE with all tables excluded. 2019-02-22 12:23:19 -05:00
parser Fix ecpg bugs caused by missing semicolons in the backend grammar. 2019-02-24 12:51:50 -05:00
partitioning Move code for managing PartitionDescs into a new file, partdesc.c 2019-02-21 11:45:02 -05:00
po Translation updates 2018-06-25 12:37:18 +02:00
port Add shared_memory_type GUC. 2019-02-03 12:47:26 +01:00
postmaster Report correct name in autovacuum "work items" activity 2019-02-22 13:00:16 -03:00
regex Update copyright for 2019 2019-01-02 12:44:25 -05:00
replication Mark correctly initial slot snapshots with MVCC type when built 2019-02-20 12:31:07 +09:00
rewrite Fix DEFAULT-handling in multi-row VALUES lists for updatable views. 2019-02-20 08:30:21 +00:00
snowball Update copyright for 2019 2019-01-02 12:44:25 -05:00
statistics Rename nodes/relation.h to nodes/pathnodes.h. 2019-01-29 16:49:25 -05:00
storage Tolerate EINVAL when calling fsync() on a directory. 2019-02-24 23:50:20 +13:00
tcop More unconstify use 2019-02-13 11:50:16 +01:00
tsearch Update copyright for 2019 2019-01-02 12:44:25 -05:00
utils Fix inconsistent out-of-memory error reporting in dsa.c. 2019-02-25 11:11:40 +13:00
.gitignore
Makefile Ensure link commands list *.o files before LDFLAGS. 2019-01-02 13:57:54 -05:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Translation updates 2018-06-25 12:37:18 +02:00