On Sun, 2009-12-06 at 10:51 +0000, Simon Riggs wrote:
> > 5. You removed this comment from KnownAssignedXidsAdd:
> >
> > - /*
> > - * XXX: We should check that we don't exceed maxKnownAssignedXids.
> > - * Even though the hash table might hold a few more entries than that,
> > - * we use fixed-size arrays of that size elsewhere and expected all
> > - * entries in the hash table to fit.
> > - */
> >
> > I think the issue still exists. The comment refers to
> > KnownAssignedXidsGet, which takes as an argument an array that has to be
> > large enough to hold all entries in the known-assigned hash table. If
> > there's more entries than expected in the hash table,
> > KnownAssignedXidsGet will overrun the array. Perhaps
> > KnownAssignedXidsGet should return a palloc'd array instead or
> > something, but I don't think it's fine as it is.
>
> Same issue perhaps, different place.
Well, its not same issue. One was about entering things into a shared
memory hash table, one is about reading values into an locally malloc'd
array. The array is sized as the max size of KnownAssignedXids, so there
is no danger that there would ever be an overrun.
One caller does not set the max size explicitly, so I will add a
comment/code changes to make that clearer.
-- Simon Riggs www.2ndQuadrant.com