Re: [PATCH] avoid buffer underflow in errfinish()

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Xi Wang <xi(dot)wang(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] avoid buffer underflow in errfinish()
Date: 2013-03-27 12:50:16
Message-ID: CA+TgmoYjHVXgC77u8H=jxSd3cGCV+RUH1x=QDb0dGC=ovDOZqA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Mar 23, 2013 at 6:45 PM, Xi Wang <xi(dot)wang(at)gmail(dot)com> wrote:
> A side question: at src/backend/storage/lmgr/proc.c:1150, is there a
> null pointer deference for `autovac'?

Not really. If the deadlock_state is DS_BLOCKED_BY_AUTOVACUUM, there
has to be a blocking autovacuum proc. As in the other case that you
found, though, some code rearrangement would likely make the intent of
the code more clear and avoid future mistakes.

Perhaps something like:

if (deadlock_state == DS_BLOCKED_BY_AUTOVACUUM &&
allow_autovacuum_cancel
&& (autovac = GetBlockingAutoVacuumPgproc()) != NULL)
{
PGXACT *autovac_pgxact =
&ProcGlobal->allPgXact[autovac->pgprocno];
...

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-03-27 12:58:02 Re: [COMMITTERS] pgsql: sepgsql: Support for new post-ALTER access hook.
Previous Message Robert Haas 2013-03-27 12:45:51 Re: [PATCH] avoid buffer underflow in errfinish()