| From: | PG Bug reporting form <noreply(at)postgresql(dot)org> | 
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org | 
| Cc: | hghwng(at)gmail(dot)com | 
| Subject: | BUG #16330: psql accesses null pointer in connect.c:do_connect | 
| Date: | 2020-03-30 02:20:48 | 
| Message-ID: | 16330-b34835d83619e25d@postgresql.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-bugs | 
The following bug has been logged on the website:
Bug reference:      16330
Logged by:          Hugh Wang
Email address:      hghwng(at)gmail(dot)com
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alexander Lakhin | 2020-03-30 05:00:00 | Re: BUG #16329: Valgrind detects an invalid read when building a gist index with buffering | 
| Previous Message | Hugh Wang | 2020-03-30 02:10:10 | Re: BUG #16321: Memory leaks in PostmasterMain |