From: Daniel Gustafsson <dgustafsson@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve error message for to lrage LO read requests
Date: Thu, 19 Nov 2026 09:16:20 +0000
Message-ID: <E1xTyFf-00000000MV5-19gK@gemulon.postgresql.org> (raw)
Improve error message for to lrage LO read requests
Calling loread() with a length argument which exceeds the max
allocation yields an invalid memory alloc error message, and
if the length overflows it will be a nonsensical value which
can be confusing.
select loread(1, 2147483647);
ERROR: invalid memory alloc request size 18446744071562067971
Fix by detecting an oversize length request and error out like
how other LO read functions do. The error message is identical
to already existing messages to avoid new translation work.
This is not backpatched as the current behavior is safe, this
is only an improvement in the messaging.
Author: Daniel Gustafsson <daniel@yesql.se>
Reported-by: Zheng Hacker <hackerzheng666@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19905-3f33374cbee82db1@postgresql.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/2c077c7d602dba034e209227ea04a14b10797c42
Modified Files
--------------
src/backend/libpq/be-fsstubs.c | 5 +++++
1 file changed, 5 insertions(+)
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: dgustafsson@postgresql.org
Subject: Re: pgsql: Improve error message for to lrage LO read requests
In-Reply-To: <E1xTyFf-00000000MV5-19gK@gemulon.postgresql.org>
References: <E1xTyFf-00000000MV5-19gK@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