pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Markus Wanner <markus.wanner@2ndquadrant.com>
To: pgsql-bugs@postgresql.org, Robert Haas <robertmhaas@gmail.com>
Subject: Re: invalid alloc size error possible in shm_mq
Date: Tue, 25 Aug 2020 12:00:06 +0200
Message-ID: <3e428657-26ce-ed05-a7cf-7f2a546c2672@2ndquadrant.com> (raw)
In-Reply-To: <3bb363e7-ac04-0ac4-9fe8-db1148755bfa@2ndquadrant.com>
References: <3bb363e7-ac04-0ac4-9fe8-db1148755bfa@2ndquadrant.com>

On 2020-07-07 12:30, Markus Wanner wrote:
> in shm_mq_receive of shm_mq.c, a huge payload may trigger an unjustified
> "invalid memory alloc request size" error due to the way the buffer size
> is increased.
> 
> I understand that this fine piece of infrastructure may not have been
> designed for huge payloads.  I still argue it should better not fail
> that way for payloads between half a gigabyte and MaxAllocSize.  The
> attached patch adds an appropriate assertion (documenting the upper
> limit) and avoids the error by limiting the allocation size to
> MaxAllocSize (to correct for such huge payloads below the limit).

I wonder if the assertion is appropriate or whether it should be a full 
error check.  Is anything on the sending side ensuring that the maximum 
size is kept?  All the size variables are Size/size_t so could be much 
larger than MaxAllocSize.

Robert, thoughts?

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





view thread (6+ messages)  latest in thread

Message-ID: <3e428657-26ce-ed05-a7cf-7f2a546c2672@2ndquadrant.com>
Permalink:  ../3e428657-26ce-ed05-a7cf-7f2a546c2672@2ndquadrant.com/
Also on:    postgresql.org/message-id/3e428657-26ce-ed05-a7cf-7f2a546c2672@2ndquadrant.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, markus.wanner@2ndquadrant.com, robertmhaas@gmail.com
  Subject: Re: invalid alloc size error possible in shm_mq
  In-Reply-To: <3e428657-26ce-ed05-a7cf-7f2a546c2672@2ndquadrant.com>

* 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