pgsql: In array_position()/array_positions(), beware of empty input arr

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: In array_position()/array_positions(), beware of empty input arr
Дата
Msg-id E1pubCB-000Sk1-SA@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
In array_position()/array_positions(), beware of empty input array.

These functions incautiously fetched the array's first lower bound
even when the array is zero-dimensional, thus fetching the word
after the allocated array space.  While almost always harmless,
with very bad luck this could result in SIGSEGV.  Fix by adding
an early exit for empty input.

Per bug #17920 from Alexander Lakhin.

Discussion: https://postgr.es/m/17920-f7c228c627b6d02e%40postgresql.org

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ccb479e76ac3032ef942f5d4f6a3ab742c2db03e

Modified Files
--------------
src/backend/utils/adt/array_userfuncs.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Tighten array dimensionality checks in Python -> SQL array conve
Следующее
От: Alvaro Herrera
Дата:
Сообщение: pgsql: Fix ExecCheckPermissions call in RI_Initial_Check