Re: Segmentation fault during update inside ExecBRUpdateTriggers

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Piotr Gabriel Kosinski <pg.kosinski@gmail.com>, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2019-08-15T23:26:57Z
Lists: pgsql-bugs

Attachments

I wrote:
> [ thinks some more... ]  Actually, I'm beginning to recall that
> we made changes here because v11 plpgsql is capable of actually
> returning "trigtuple" where before it would always have made a copy.
> If that's accurate, then very likely the bug exists further back
> but requires some other PL than plpgsql to manifest.

As I suspected ... the attached test case crashes 9.4 through 11.
We already had some problems in this area, which is why a suitable
trigger is already at hand in regress.c.

			regards, tom lane

Commits

  1. Prevent possible double-free when update trigger returns old tuple.

  2. Prevent dangling-pointer access when update trigger returns old tuple.