Skip site navigation (1) Skip section navigation (2)

pgsql: Avoid somewhat-theoretical overflow risks in RecordIsValid().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid somewhat-theoretical overflow risks in RecordIsValid().
Date: 2012-08-21 22:42:02
Message-ID: E1T3x98-0001VB-QX@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Avoid somewhat-theoretical overflow risks in RecordIsValid().

This improves on commit 51fed14d73ed3acd2282b531fb1396877e44e86a by
eliminating the assumption that we can form <some pointer value> +
<some offset> without overflow.  The entire point of those tests is that
we don't trust the offset value, so coding them in a way that could wrap
around if the buffer happens to be near the top of memory doesn't seem
sound.  Instead, track the remaining space as a size_t variable and
compare offsets against that.

Also, improve comment about why we need the extra early check on
xl_tot_len.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/10685ec082181b285a48d982b4c3463fd80ee5ae

Modified Files
--------------
src/backend/access/transam/xlog.c |   26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)

pgsql-committers by date

Next:From: Tom LaneDate: 2012-08-22 02:58:00
Subject: pgsql: Update 9.2 release notes to reflect commits to date.
Previous:From: Tom LaneDate: 2012-08-21 19:20:59
Subject: pgsql: Fix dumping of security_barrier views with circulardependencies

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group