Re: BUG #16694: Server hangs in 100% CPU loop when decompressing a specific TOAST Postgis linestring

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Cc: tvijlbrief(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Subject: Re: BUG #16694: Server hangs in 100% CPU loop when decompressing a specific TOAST Postgis linestring
Date: 2020-11-02 05:53:48
Message-ID: 595534.1604296428@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Andrey Borodin <x4mmm(at)yandex-team(dot)ru> writes:
>> 2 нояб. 2020 г., в 10:16, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> написал(а):
>> Yeah, I was wondering about that. Not quite sure it's worth adding
>> cycles to defend against though.

> I think so too. That's why I was not protecting from corruption at all when proposing c60e520.
> Here we can have core dump too if *(srcend+1) produce SegFault:

Right. The "sp > srcend" check that I added doesn't help if we
were unlucky enough to be right up against the end of memory.
I judged it was cheap enough to be worth including, but I'd
agree that's a judgment call. Conversely, checking for "off"
being too far back would require tracking the distance back to
the start of the output buffer, which is a value the loop does
not keep ATM. So that would require adding more cycles to track
(in addition to the actual comparison), which is why it seemed
not quite worth it.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Justin Pryzby 2020-11-02 06:33:33 Re: BUG #16486: Prompted password is ignored when password specified in connection string
Previous Message Andrey Borodin 2020-11-02 05:33:09 Re: BUG #16694: Server hangs in 100% CPU loop when decompressing a specific TOAST Postgis linestring