pgsql: Fix potential NULL pointer dereference in getIdentitySequence()

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема pgsql: Fix potential NULL pointer dereference in getIdentitySequence()
Дата
Msg-id E1sBCWU-001pvr-Ot@gemulon.postgresql.org
обсуждение исходный текст
Ответы Re: pgsql: Fix potential NULL pointer dereference in getIdentitySequence()
Список pgsql-committers
Fix potential NULL pointer dereference in getIdentitySequence()

The function invokes SearchSysCacheAttNum() and SearchSysCacheAttName().
They may respectively return 0 for the attribute number or NULL for
the attribute name if the attribute does not exist, without any kind of
error handling.  The common practice is to check that the data retrieved
from the syscache is valid.  There is no risk of NULL pointer
dereferences currently, but let's stick to the practice of making sure
that this data is always valid, to catch future inconsistency mistakes.
The code is switched to use get_attnum() and get_attname(), and adds
some error handling.

Oversight in 509199587df7.

Reported-by: Ranier Vilela
Author: Ashutosh Bapat
Discussion: https://postgr.es/m/CAEudQAqh_RZqoFcYKso5d9VhF-Vd64_ZodfQ_2zSusszkEmyRg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8285b484a47d829a29fbe0ebe65cdc9f9dfb179d

Modified Files
--------------
src/backend/catalog/pg_depend.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)


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

Предыдущее
От: Alexander Korotkov
Дата:
Сообщение: pgsql: amcheck: Fixes for right page check during unique constraint che
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: pgsql: Fix potential NULL pointer dereference in getIdentitySequence()