Re: BUG #17858: ExecEvalArrayExpr() leaves uninitialised memory for multidim array with nulls

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: Richard Guo <guofenglinux@gmail.com>, pgsql-bugs@lists.postgresql.org
Date: 2023-03-21T14:24:28Z
Lists: pgsql-bugs
Alexander Lakhin <exclusion@gmail.com> writes:
> I'm afraid that zeroing only bytes behind nitems bits is not enough, as outDatum() doesn't bother to calculate the exact 
> size of nulls bitmap, it just outputs all bytes of a datum (40 bytes in that case):

In that case, won't padding bytes between array elements also create
issues?  Seems like we have to just zero the whole array area, like
those other functions do.

			regards, tom lane



Commits

  1. Fix oversights in array manipulation.

  2. Fix array- and path-creating functions to ensure padding bytes are zeroes.