pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: uwe.binder@pass-consulting.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18080: to_tsvector fails for long text input
Date: Fri, 15 Sep 2023 09:53:49 -0400
Message-ID: <3300287.1694786029@sss.pgh.pa.us> (raw)
In-Reply-To: <202309151141.pq2zpi5kxdvn@alvherre.pgsql>
References: <202309151141.pq2zpi5kxdvn@alvherre.pgsql>

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> On 2023-Sep-04, PG Bug reporting form wrote:
>> SELECT to_tsvector('english'::regconfig, (REPEAT('<Long123456789/>'::text,
>> 20000000)));
>> results in
>> ERROR:  invalid memory alloc request size 2133333320

> This is because to_tsvector_byid does this:
>     prs.lenwords = VARSIZE_ANY_EXHDR(in) / 6;    /* just estimation of word's
>                                                  * number */
>     if (prs.lenwords < 2)
>         prs.lenwords = 2;

Yeah.  My thought about blocking the error had been to limit
prs.lenwords to MaxAllocSize/sizeof(ParsedWord) in this code.
I doubt that switching over to MCXT_ALLOC_HUGE is a good idea.
(Would we not also have to touch the places that repalloc that
array?)

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <3300287.1694786029@sss.pgh.pa.us>
Permalink:  ../3300287.1694786029@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3300287.1694786029@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, alvherre@alvh.no-ip.org, uwe.binder@pass-consulting.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18080: to_tsvector fails for long text input
  In-Reply-To: <3300287.1694786029@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