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_2zsusszkem...@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(-)