Re: BUG #15540: Use after release in ExecuteTruncateGuts
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: bianpan2016@163.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2018-12-07T16:09:05Z
Lists: pgsql-bugs
=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes: > The function ExecuteTruncateGuts drops the reference to rel via > relation_close when toast_relid is valid. However, after that, rel is passed > to pgstat_count_truncate. This may result in a use-after-release bug. ... and, even more to the point, the truncation stats count is incorrectly applied to the toast table not its parent. > Maybe, > rel should be re-declared on the branch that toast_relid is valid. Yeah, seems like the right way. Will fix. Are you using a static analyzer to find these? I'm curious how you noticed them. regards, tom lane
Commits
-
Fix misapplication of pgstat_count_truncate to wrong relation.
- aedd3d4dbd6e 11.2 landed
- 54f24ab76ded 10.7 landed
- 4d5cfb91156d 9.5.16 landed
- 078303f79b51 9.6.12 landed
- 5deadfef2827 12.0 landed