[PATCH] Fix null pointer dereference in PG19 - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject [PATCH] Fix null pointer dereference in PG19
Date
Msg-id CAJ7c6TME+ix6VRf-2TPnVTsj8qn_hy6sYAOmMhZEivwsu2wS6g@mail.gmail.com
Whole thread
Responses Re: [PATCH] Fix null pointer dereference in PG19
List pgsql-hackers
Hi,

I discovered that it's possible to crash Postgres when using VIEWS,
FOR PORTION OF syntax and INSTEAD OF triggers together. See crash.sql.

This happens because in ExecModifyTable() around line 4827 there is no
check for `relkind == RELKIND_VIEW`. If this is the case `tupleid`
ends up being NULL which causes null pointer dereference later when
ExecDeleteEpilogue() or ExecUpdateEpilogue() calls
ExecForPortionOfLeftovers() with tupleid = NULL. An example stacktrace
is attached.

I propose fixing this by explicitly forbidding using the named
features together. See the patch.


-- 
Best regards,
Aleksander Alekseev

Attachment

pgsql-hackers by date:

Previous
From: "Matheus Alcantara"
Date:
Subject: Re: MERGE PARTITIONS and DEPENDS ON EXTENSION.
Next
From: Alexander Korotkov
Date:
Subject: Re: Two issues leading to discrepancies in FSM data on the standby server