PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID16330
PG Version12.2
OSArch Linux
Opened2020-03-30 02:20:48+00
Reported byHugh Wang
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      16330
Logged by:          Hugh Wang
Email address:      (redacted)
PostgreSQL version: 12.2
Operating system:   Arch Linux
Description:        

If the connection to postmaster is closed, then trying to re-connect to
another one leads to SIGSEGV.

REPRODUCE:
$ psql
-> \conninfo
You are connected to database "hugh" as user "hugh" via socket in
"/run/postgresql" at port "5432".
*shut down server with commands like "systemctl stop postgresql"*
-> \conninfo 
You are currently not connected to a database.
-> \c a b c d
[1]    984978 segmentation fault (core dumped)  psql

ANALYSIS:
PQhost(o_conn) returns NULL, and strcmp(host, NULL) raises SIGSEGV.

SOURCE:
https://github.com/postgres/postgres/blob/master/src/bin/psql/command.c#L3016

Messages

DateAuthorSubject
2020-03-30 02:20:48+00PG Bug reporting formBUG #16330: psql accesses null pointer in connect.c:do_connect
2020-03-30 07:19:37+00Michael PaquierRe: BUG #16330: psql accesses null pointer in connect.c:do_connect
2020-03-30 15:35:41+00Tom LaneRe: BUG #16330: psql accesses null pointer in connect.c:do_connect
2020-03-30 15:48:51+00Alvaro HerreraRe: BUG #16330: psql accesses null pointer in connect.c:do_connect
2020-03-31 07:21:53+00Michael PaquierRe: BUG #16330: psql accesses null pointer in connect.c:do_connect
2020-03-31 13:43:36+00Tom LaneRe: BUG #16330: psql accesses null pointer in connect.c:do_connect
2020-03-31 13:52:59+00Alvaro HerreraRe: BUG #16330: psql accesses null pointer in connect.c:do_connect
2020-04-01 06:07:25+00Michael PaquierRe: BUG #16330: psql accesses null pointer in connect.c:do_connect