Re: pg_regress/pg_isolation_regress: Fix possible nullptr dereference.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Xing Guo <higuoxing(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_regress/pg_isolation_regress: Fix possible nullptr dereference.
Date: 2022-11-30 16:59:48
Message-ID: 1357296.1669827588@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Xing Guo <higuoxing(at)gmail(dot)com> writes:
> While playing with pg_regress and pg_isolation_regress, I noticed that
> there's a potential nullptr deference in both of them.
> How to reproduce:
> Specify the `--dbname=` option without providing any database name.

Hmm, yeah, I see that too.

> Patch is attached.

This patch seems like a band-aid, though. The reason nobody's
noticed this for decades is that it doesn't make a lot of sense
to allow tests to run in your default database: the odds of them
screwing up something valuable are high, and the odds that they'll
fail if started in a nonempty database are even higher.

I think the right answer is to treat it as an error if we end up
with an empty dblist (or even a zero-length name).

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message gkokolatos 2022-11-30 17:11:44 Re: Add LZ4 compression in pg_dump
Previous Message Peter Geoghegan 2022-11-30 16:35:15 Re: Add 64-bit XIDs into PostgreSQL 15