]> granicus.if.org Git - postgresql/commit
Fix miscalculation of itemsafter in array_set_slice().
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 17 Jan 2011 17:38:52 +0000 (12:38 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 17 Jan 2011 17:40:13 +0000 (12:40 -0500)
commitd8b0495f9637636b8a89e3b98208beb0a2d64fd0
tree04865593ffafdb4be2e06f527764335c4e1d7f63
parent051096d06ece0c553e8ed85bfe45129f488a806d
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.
src/backend/utils/adt/arrayfuncs.c