pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix list_copy_head() with empty Lists 5+ messages / 3 participants [nested] [flat]
* pgsql: Fix list_copy_head() with empty Lists @ 2023-04-19 22:35 David Rowley <drowley@postgresql.org> 0 siblings, 1 reply; 5+ messages in thread From: David Rowley @ 2023-04-19 22:35 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Fix list_copy_head() with empty Lists @ 2023-04-20 13:28 Tom Lane <tgl@sss.pgh.pa.us> parent: David Rowley <drowley@postgresql.org> 0 siblings, 1 reply; 5+ messages in thread From: Tom Lane @ 2023-04-20 13:28 UTC (permalink / raw) To: David Rowley <drowley@postgresql.org>; +Cc: pgsql-committers@lists.postgresql.org David Rowley <drowley@postgresql.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 ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix list_copy_head() with empty Lists @ 2023-04-20 22:03 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: David Rowley @ 2023-04-20 22:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/63a03aea6bc89060010255e8e61c83f95e1daec8 Modified Files -------------- src/backend/nodes/list.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Fix list_copy_head() with empty Lists @ 2023-04-20 22:07 David Rowley <dgrowleyml@gmail.com> parent: Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 1 reply; 5+ messages in thread From: David Rowley @ 2023-04-20 22:07 UTC (permalink / raw) To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David Rowley <drowley@postgresql.org>; pgsql-committers@lists.postgresql.org On Fri, 21 Apr 2023 at 01:28, Tom Lane <tgl@sss.pgh.pa.us> wrote: > 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. Doh :-( Thanks for alerting me. I've just applied the patch to REL_15_STABLE. I kept the same commit message as master, which I think was the correct thing to do, despite it containing information that wasn't true. I know the script used to assist release note creation goes on commit messages to determine which commits went into which branches. > Or, maybe, remove it in 15? I chickened out of that as it does not seem impossible that someone is making use of it. It seems lightweight enough not to have to worry too much about keeping it around. David ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Fix list_copy_head() with empty Lists @ 2023-04-20 22:18 Tom Lane <tgl@sss.pgh.pa.us> parent: David Rowley <dgrowleyml@gmail.com> 0 siblings, 0 replies; 5+ messages in thread From: Tom Lane @ 2023-04-20 22:18 UTC (permalink / raw) To: David Rowley <dgrowleyml@gmail.com>; +Cc: David Rowley <drowley@postgresql.org>; pgsql-committers@lists.postgresql.org David Rowley <dgrowleyml@gmail.com> writes: > Doh :-( Thanks for alerting me. I've just applied the patch to REL_15_STABLE. > I kept the same commit message as master, which I think was the > correct thing to do, despite it containing information that wasn't > true. I know the script used to assist release note creation goes on > commit messages to determine which commits went into which branches. Yeah, that's definitely easier for release notes, so thanks. regards, tom lane ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2023-04-20 22:18 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2023-04-19 22:35 pgsql: Fix list_copy_head() with empty Lists David Rowley <drowley@postgresql.org> 2023-04-20 13:28 ` Tom Lane <tgl@sss.pgh.pa.us> 2023-04-20 22:07 ` David Rowley <dgrowleyml@gmail.com> 2023-04-20 22:18 ` Tom Lane <tgl@sss.pgh.pa.us> 2023-04-20 22:03 pgsql: Fix list_copy_head() with empty Lists David Rowley <drowley@postgresql.org>
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