Re: [Patch] Fix bounds check in trim_array()

2022-07-31 Thread Tom Lane
Nathan Bossart writes: > On Mon, Jul 25, 2022 at 04:40:51PM +0200, Martin Kalcher wrote: >> +SELECT trim_array(ARRAY[]::int[], 1); -- fail >> +ERROR: number of elements to trim must be between 0 and 0 > Can we improve the error message? Maybe it should look something like > ERROR: number

Re: [Patch] Fix bounds check in trim_array()

2022-07-28 Thread Nathan Bossart
On Mon, Jul 25, 2022 at 04:40:51PM +0200, Martin Kalcher wrote: > +SELECT trim_array(ARRAY[]::int[], 1); -- fail > +ERROR: number of elements to trim must be between 0 and 0 Can we improve the error message? Maybe it should look something like ERROR: number of elements to trim must be

[Patch] Fix bounds check in trim_array()

2022-07-25 Thread Martin Kalcher
0200 Subject: [PATCH] Fix bounds check in trim_array() The bounds check in trim_array() failed for empty arrays without any dimension. It read the size of the first dimension without checking its existence. --- src/backend/utils/adt/arrayfuncs.c | 2 +- src/test/regress/expected/arrays.out | 2 ++