Re: [PATCH][BUG FIX] Unsafe access pointers.

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Ranier Vilela <ranier_gyn(at)hotmail(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH][BUG FIX] Unsafe access pointers.
Date: 2019-11-18 17:42:04
Message-ID: 20191118174204.GA24784@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-Nov-15, Ranier Vilela wrote:

> Hi,
> Last time, I promise.
>
> It's probably not happening, but it can happen, I think.

This patch assumes that anything can happen after elog(ERROR). That's
wrong -- under ERROR or higher, elog() (as well as ereport) never
returns to the caller. If this was possible, there would be thousands
of places that would need to be patched, all over the server code. But
it's not.

> /* Fetch opclass information */
> classtup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassoid));
> - if (!HeapTupleIsValid(classtup))
> + if (!HeapTupleIsValid(classtup)) {
> elog(ERROR, "cache lookup failed for operator class %u", opclassoid);
> + return false;
> + }

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-11-18 17:49:50 Re: Reverse collations (initially for making keyset pagination cover more cases)
Previous Message Tom Lane 2019-11-18 17:21:53 Re: Invisible PROMPT2