Re: BUG #19905: loread() with length near INT_MAX: "invalid memory alloc request size" (int32 overflow)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: hackerzheng666(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19905: loread() with length near INT_MAX: "invalid memory alloc request size" (int32 overflow)
Date: 2026-11-16 18:37:42
Message-ID: 123991.1794854262@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
>> On 15 Nov 2026, at 05:49, PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Daniel Gustafsson 2026-11-16 18:49:14 Re: BUG #19905: loread() with length near INT_MAX: "invalid memory alloc request size" (int32 overflow)
Previous Message Melanie Plageman 2026-11-16 18:13:18 Re: PostgreSQL 18.6/17.11: standby PANIC on restart after VM truncation