From: Tom Lane <tgl@sss.pgh.pa.us>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: hackerzheng666@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19905: loread() with length near INT_MAX: "invalid memory alloc request size" (int32 overflow)
Date: Mon, 16 Nov 2026 13:37:42 -0500
Message-ID: <123991.1794854262@sss.pgh.pa.us> (raw)
In-Reply-To: <B5B036C4-8812-4C8C-A28A-23704BF2F857@yesql.se>
References: <19905-3f33374cbee82db1@postgresql.org>
<B5B036C4-8812-4C8C-A28A-23704BF2F857@yesql.se>
Daniel Gustafsson <daniel@yesql.se> writes:
>> On 15 Nov 2026, at 05:49, PG Bug reporting form <noreply@postgresql.org> wrote:
>> Clamping len
>> to MaxAllocSize - VARHDRSZ (or raising "requested length too large" before
>> the allocation, as lo_get() style paths do) would give a proper message.
> As far as bugs go, this is pretty low on the prioritylist; but since I had a
> look at it I think we should error out like lo_get().
Is it really worth the trouble at all? (It's not just your time to
commit this, it's that you're loading more work on the translators.)
I don't see any non-nefarious case in which we'd hit this error,
so letting the palloc error come out seems fine to me.
regards, tom lane
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, daniel@yesql.se, hackerzheng666@gmail.com
Subject: Re: BUG #19905: loread() with length near INT_MAX: "invalid memory alloc request size" (int32 overflow)
In-Reply-To: <123991.1794854262@sss.pgh.pa.us>
References: <19905-3f33374cbee82db1@postgresql.org> <B5B036C4-8812-4C8C-A28A-23704BF2F857@yesql.se> <123991.1794854262@sss.pgh.pa.us>
* 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