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

pgsql: Fix miscalculation of itemsafter in array_set_slice().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix miscalculation of itemsafter in array_set_slice().
Date: 2011-01-17 18:13:35
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-committers
Fix miscalculation of itemsafter in array_set_slice().

If the slice to be assigned to was before the existing array lower bound
(requiring at least one null element to spring into existence to fill the
gap), the code miscalculated how many entries needed to be copied from
the old array's null bitmap.  This could result in trashing the array's
data area (as seen in bug #5840 from Karsten Loesing), or worse.

This has been broken since we first allowed the behavior of assigning to
non-adjacent slices, in 8.2.  Back-patch to all affected versions.



Modified Files
src/backend/utils/adt/arrayfuncs.c |    6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

pgsql-committers by date

Next:From: Peter EisentrautDate: 2011-01-17 19:49:12
Subject: pgsql: Use HTABs instead of Python dictionary objects to cacheprocedur
Previous:From: Alvaro HerreraDate: 2011-01-17 16:07:52
Subject: pgsql: Increment Py_None refcount for NULL array elements

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