pgsql: Fix segmentation fault in MergeInheritedAttribute()

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix segmentation fault in MergeInheritedAttribute()
Date: 2024-05-03 09:15:50
Message-ID: E1s2p1B-001HDX-0b@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix segmentation fault in MergeInheritedAttribute()

While converting a pg_attribute tuple into a ColumnDef,
ColumnDef::compression remains NULL if there is no compression method
set fot the attribute. Calling strcmp() with NULL
ColumnDef::compression, when comparing compression methods of parents,
causes segmentation fault in MergeInheritedAttribute(). Skip
comparing compression methods if either of them is NULL.

Author: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Reported-by: Alexander Lakhin <exclusion(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/b22a6834-aacb-7b18-0424-a3f5fe889667%40gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8f0a97dfffc5b5f48f609fb894befcdf761dd576

Modified Files
--------------
src/backend/commands/tablecmds.c | 16 ++++++++++------
src/test/regress/expected/compression.out | 10 +++++++---
src/test/regress/sql/compression.sql | 8 +++++---
3 files changed, 22 insertions(+), 12 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2024-05-03 13:12:24 pgsql: Fix expected test output
Previous Message Daniel Gustafsson 2024-05-03 08:44:39 Re: pgsql: Fix compilation on OpenSSL 1.0.2 and LibreSSL