pgsql: Fix bogus CALLED_AS_TRIGGER() defenses. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix bogus CALLED_AS_TRIGGER() defenses.
Date
Msg-id E1jKOC4-0003an-GB@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix bogus CALLED_AS_TRIGGER() defenses.

contrib/lo's lo_manage() thought it could use
trigdata->tg_trigger->tgname in its error message about
not being called as a trigger.  That naturally led to a core dump.

unique_key_recheck() figured it could Assert that fcinfo->context
is a TriggerData node in advance of having checked that it's
being called as a trigger.  That's harmless in production builds,
and perhaps not that easy to reach in any case, but it's logically
wrong.

The first of these per bug #16340 from William Crowell;
the second from manual inspection of other CALLED_AS_TRIGGER
call sites.

Back-patch the lo.c change to all supported branches, the
other to v10 where the thinko crept in.

Discussion: https://postgr.es/m/16340-591c7449dc7c8c47@postgresql.org

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/82bc56e63387176809349b559ee224c11671d818

Modified Files
--------------
contrib/lo/lo.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)


pgsql-committers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: pgsql: Include information on buffer usage during planning phase,in EX
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Include information on buffer usage during planning phase, in EX