pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix list_copy_head() with empty Lists
Date: Wed, 19 Apr 2023 22:35:03 +0000
Message-ID: <E1ppGOE-003u13-4o@gemulon.postgresql.org> (raw)

Fix list_copy_head() with empty Lists

list_copy_head() given an empty List would crash from trying to
dereference the List to obtain its length.  Since NIL is how we represent
an empty List, we should just be returning another empty List in this
case.

list_copy_head() is new to v16, so let's fix it now before too many people
start coding around the buggy NIL behavior.

Reported-by: Miroslav Bendik
Discussion: https://postgr.es/m/CAPoEpV02WhawuWnmnKet6BqU63bEu7oec0pJc=nKMtPsHMzTXQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e35ded29566f679e52888a8d34468bb51bc78bed

Modified Files
--------------
src/backend/nodes/list.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1ppGOE-003u13-4o@gemulon.postgresql.org>
Permalink:  ../E1ppGOE-003u13-4o@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ppGOE-003u13-4o@gemulon.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-committers@postgresql.org
  Cc: drowley@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix list_copy_head() with empty Lists
  In-Reply-To: <E1ppGOE-003u13-4o@gemulon.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