]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Avoid invalid alloc size error in shm_mq
authorPeter Eisentraut <peter@eisentraut.org>
Mon, 19 Oct 2020 06:52:25 +0000 (08:52 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Tue, 20 Oct 2020 13:19:47 +0000 (15:19 +0200)
commitf78ebbe68f48b7bb4fe8e23b5a30c32dfc452331
tree1519704694af2b1b15df8d3e649ef951cd20cea0
parent68f2369930f923df79fef4c62843a40baa1facec
Avoid invalid alloc size error in shm_mq

In shm_mq_receive(), a huge payload could trigger an unjustified
"invalid memory alloc request size" error due to the way the buffer
size is increased.

Add error checks (documenting the upper limit) and avoid the error by
limiting the allocation size to MaxAllocSize.

Author: Markus Wanner <markus.wanner@2ndquadrant.com>
Discussion: https://www.postgresql.org/message-id/flat/3bb363e7-ac04-0ac4-9fe8-db1148755bfa%402ndquadrant.com
src/backend/storage/ipc/shm_mq.c