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

pgsql: Fix SPI_getvalue and SPI_getbinval to range-check the given

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix SPI_getvalue and SPI_getbinval to range-check the given
Date: 2008-10-16 13:23:49
Message-ID: 20081016132349.3BCA47545A4@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Fix SPI_getvalue and SPI_getbinval to range-check the given attribute number
according to the TupleDesc's natts, not the number of physical columns in the
tuple.  The previous coding would do the wrong thing in cases where natts is
different from the tuple's column count: either incorrectly report error when
it should just treat the column as null, or actually crash due to indexing off
the end of the TupleDesc's attribute array.  (The second case is probably not
possible in modern PG versions, due to more careful handling of inheritance
cases than we once had.  But it's still a clear lack of robustness here.)

The incorrect error indication is ignored by all callers within the core PG
distribution, so this bug has no symptoms visible within the core code, but
it might well be an issue for add-on packages.  So patch all the way back.

Tags:
----
REL8_0_STABLE

Modified Files:
--------------
    pgsql/src/backend/executor:
        spi.c (r1.133.4.3 -> r1.133.4.4)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/spi.c?r1=1.133.4.3&r2=1.133.4.4)

pgsql-committers by date

Next:From: Tom LaneDate: 2008-10-16 13:23:57
Subject: pgsql: Fix SPI_getvalue and SPI_getbinval to range-check the given
Previous:From: Tom LaneDate: 2008-10-16 13:23:42
Subject: pgsql: Fix SPI_getvalue and SPI_getbinval to range-check the given

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