pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid invalid alloc size error in shm_mq
Date: Tue, 20 Oct 2020 16:17:10 +0000
Message-ID: <E1kUuJy-0002EJ-JE@gemulon.postgresql.org> (raw)

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

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6e03a8a304a2f31ffafb5f229794747c01af6936

Modified Files
--------------
src/backend/storage/ipc/shm_mq.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)



view thread (7+ messages)  latest in thread

Message-ID: <E1kUuJy-0002EJ-JE@gemulon.postgresql.org>
Permalink:  ../E1kUuJy-0002EJ-JE@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kUuJy-0002EJ-JE@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org
  Subject: Re: pgsql: Avoid invalid alloc size error in shm_mq
  In-Reply-To: <E1kUuJy-0002EJ-JE@gemulon.postgresql.org>
  References: <E1kUuJy-0002EJ-JE@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox