pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix trim_array() for zero-dimensional array argument. 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix trim_array() for zero-dimensional array argument. @ 2022-07-31 17:43 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2022-07-31 17:43 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix trim_array() for zero-dimensional array argument. The code tried to access ARR_DIMS(v)[0] and ARR_LBOUND(v)[0] whether or not those values exist. This made the range check on the "n" argument unstable --- it might or might not fail, and if it did it would report garbage for the allowed upper limit. These bogus accesses would probably annoy Valgrind, and if you were very unlucky even lead to SIGSEGV. Report and fix by Martin Kalcher. Back-patch to v14 where this function was added. Discussion: https://postgr.es/m/baaeb413-b8a8-4656-5757-ef347e5ec11f@aboutsource.net Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/4ddfbd2a8ea9b41ced0cad1d984c833085f8ce91 Modified Files -------------- src/backend/utils/adt/arrayfuncs.c | 9 ++++++--- src/test/regress/expected/arrays.out | 2 ++ src/test/regress/sql/arrays.sql | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix trim_array() for zero-dimensional array argument. @ 2022-07-31 17:43 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2022-07-31 17:43 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix trim_array() for zero-dimensional array argument. The code tried to access ARR_DIMS(v)[0] and ARR_LBOUND(v)[0] whether or not those values exist. This made the range check on the "n" argument unstable --- it might or might not fail, and if it did it would report garbage for the allowed upper limit. These bogus accesses would probably annoy Valgrind, and if you were very unlucky even lead to SIGSEGV. Report and fix by Martin Kalcher. Back-patch to v14 where this function was added. Discussion: https://postgr.es/m/baaeb413-b8a8-4656-5757-ef347e5ec11f@aboutsource.net Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d386b75df553b11ba20707b2f0a74215bb9c120b Modified Files -------------- src/backend/utils/adt/arrayfuncs.c | 9 ++++++--- src/test/regress/expected/arrays.out | 2 ++ src/test/regress/sql/arrays.sql | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix trim_array() for zero-dimensional array argument. @ 2022-07-31 17:43 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2022-07-31 17:43 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix trim_array() for zero-dimensional array argument. The code tried to access ARR_DIMS(v)[0] and ARR_LBOUND(v)[0] whether or not those values exist. This made the range check on the "n" argument unstable --- it might or might not fail, and if it did it would report garbage for the allowed upper limit. These bogus accesses would probably annoy Valgrind, and if you were very unlucky even lead to SIGSEGV. Report and fix by Martin Kalcher. Back-patch to v14 where this function was added. Discussion: https://postgr.es/m/baaeb413-b8a8-4656-5757-ef347e5ec11f@aboutsource.net Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e71d4254f710bef53fa40d0b49b5af9bad10ce40 Modified Files -------------- src/backend/utils/adt/arrayfuncs.c | 9 ++++++--- src/test/regress/expected/arrays.out | 2 ++ src/test/regress/sql/arrays.sql | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2022-07-31 17:43 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-07-31 17:43 pgsql: Fix trim_array() for zero-dimensional array argument. Tom Lane <tgl@sss.pgh.pa.us> 2022-07-31 17:43 pgsql: Fix trim_array() for zero-dimensional array argument. Tom Lane <tgl@sss.pgh.pa.us> 2022-07-31 17:43 pgsql: Fix trim_array() for zero-dimensional array argument. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox