Re: pgsql: Fix list_copy_head() with empty Lists

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Rowley <drowley(at)postgresql(dot)org>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Fix list_copy_head() with empty Lists
Date: 2023-04-20 13:28:29
Message-ID: 3129478.1681997309@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

David Rowley <drowley(at)postgresql(dot)org> writes:
> 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.

I see that list_copy_head exists in v15 as well. It appears to have
no callers there, but we'd better fix it anyway in case somebody
back-patches a fix that uses it.

Or, maybe, remove it in 15?

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2023-04-20 13:47:32 pgsql: Fix autovacuum cost debug logging
Previous Message David Rowley 2023-04-20 11:53:03 pgsql: Doc: clarify NULLS NOT DISTINCT use in unique indexes