Re: [PATCH][BUG FIX] Unsafe access pointers. - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: [PATCH][BUG FIX] Unsafe access pointers.
Date
Msg-id 20191118174204.GA24784@alvherre.pgsql
Whole thread Raw
In response to [PATCH][BUG FIX] Unsafe access pointers.  (Ranier Vilela <ranier_gyn@hotmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Invisible PROMPT2
Next
From: Tom Lane
Date:
Subject: Re: Reverse collations (initially for making keyset pagination cover more cases)