Re: [PATCH] avoid buffer underflow in errfinish() - Mailing list pgsql-hackers

From Robert Haas
Subject Re: [PATCH] avoid buffer underflow in errfinish()
Date
Msg-id CA+Tgmob3JFiLWSAuRTBWybiQx-ucHzMkHwHzMGy9anOZmBLvUg@mail.gmail.com
Whole thread Raw
In response to [PATCH] avoid buffer underflow in errfinish()  (Xi Wang <xi.wang@gmail.com>)
Responses Re: [PATCH] avoid buffer underflow in errfinish()
List pgsql-hackers
On Sat, Mar 23, 2013 at 6:38 PM, Xi Wang <xi.wang@gmail.com> wrote:
> CHECK_STACK_DEPTH checks if errordata_stack_depth is negative.
> Move the dereference of &errordata[errordata_stack_depth] after
> the check to avoid out-of-bounds read.

This seems sensible and I'm inclined to commit it.  It's unlikely to
matter very much in practice, since the only point of checking the
stack depth in the first place is to catch a seemingly-unlikely coding
error; and it's unlikely that referencing beyond the stack bounds
would do anything too horrible, either.  But we may as well do it
right.

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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [sepgsql 1/3] add name qualified creation label
Next
From: Robert Haas
Date:
Subject: Re: [PATCH] avoid buffer underflow in errfinish()