pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: pm91.arapov@gmail.com
Subject: BUG #18849: DEREF_OF_NULL.RET Pointer '&partexprs_item.ptr_value', returned from function 'list_head' at partiti
Date: Fri, 14 Mar 2025 09:14:19 +0000
Message-ID: <18849-4a0299b366741739@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18849
Logged by:          Nikita
Email address:      pm91.arapov@gmail.com
PostgreSQL version: 16.6
Operating system:   ubuntu 20.04
Description:        

In principle, if data structure is correct there will be no problems. As for
correct structure it is known that there will be a non-NULL value. However
in other places that deal with the same structure the appropriate checks are
present. So for consistency we can add such a check here as well. On other
hand if the structure is checked for correctness in other places there is no
need to check it once again. So the decision on this is not very certain.

diff --git a/src/backend/catalog/partition.c
b/src/backend/catalog/partition.c
--- a/src/backend/catalog/partition.c	(revision
a49ac80219c6f28c3cf3973f797de637329952da)
+++ b/src/backend/catalog/partition.c	(date 1740397337018)
@@ -283,6 +283,8 @@
 		}
 		else
 		{
+            if(partexprs_item == NULL)
+                return false;
 			/* Arbitrary expression */
 			Node	   *expr = (Node *) lfirst(partexprs_item);
 			Bitmapset  *expr_attrs = NULL;

I suggest the following patch fixing this issue



Message-ID: <18849-4a0299b366741739@postgresql.org>
Permalink:  ../18849-4a0299b366741739@postgresql.org/
Also on:    postgresql.org/message-id/18849-4a0299b366741739@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, pm91.arapov@gmail.com
  Subject: Re: BUG #18849: DEREF_OF_NULL.RET Pointer '&partexprs_item.ptr_value', returned from function 'list_head' at partiti
  In-Reply-To: <18849-4a0299b366741739@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox