On 8/25/20 12:00 PM, Peter Eisentraut wrote:
> I wonder if the assertion is appropriate or whether it should be a full
> error check.
Good point. Originally, it used to be an error. With the patch (but
w/o assertions enabled) it could result in a buffer overrun. Not good.
I changed the patch to add an error (instead of just an assert) when
asked to read a message larger than MaxAllocSize. So this patch
essentially corrects handling of messages in size between MaxAllocSize/2
and MaxAllocSize.
> 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.
In this v2 of the patch, I added a check that errors out on the sender
side as well (for trying to send a message larger than MaxAllocSize).
I'd still recommend to back-patch this.
--
Markus Wanner
Senior PostgreSQL Developer
2ndQuadrant - PostgreSQL Solutions for the Enterprise
https://www.2ndQuadrant.com/