BUG #16837: Invalid memory access on \h in psql - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #16837: Invalid memory access on \h in psql
Date
Msg-id 16837-479bcd56040c71b3@postgresql.org
Whole thread Raw
Responses Re: BUG #16837: Invalid memory access on \h in psql
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      16837
Logged by:          Alexander Lakhin
Email address:      exclusion@gmail.com
PostgreSQL version: 13.1
Operating system:   Ubuntu 20.04
Description:

When executing in psql (under valgrind):
\h\

valgrind detects the following error:
==00:00:00:00.000 3226182== 
==00:00:00:04.045 3226182== Conditional jump or move depends on
uninitialised value(s)
==00:00:00:04.045 3226182==    at 0x1396CB: helpSQL (help.c:600)
==00:00:00:04.045 3226182==    by 0x120705: exec_command_help
(command.c:1507)
==00:00:00:04.045 3226182==    by 0x1252CD: exec_command (command.c:351)
==00:00:00:04.045 3226182==    by 0x1258A3: HandleSlashCmds
(command.c:222)
==00:00:00:04.045 3226182==    by 0x13B166: MainLoop (mainloop.c:502)
==00:00:00:04.045 3226182==    by 0x1238B3: process_file (command.c:3921)
==00:00:00:04.045 3226182==    by 0x14357A: main (startup.c:400)
==00:00:00:04.045 3226182==  Uninitialised value was created by a heap
allocation
==00:00:00:04.045 3226182==    at 0x483B7F3: malloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:00:04.045 3226182==    by 0x4AB2A1C: initPQExpBuffer
(pqexpbuffer.c:94)
==00:00:00:04.045 3226182==    by 0x13D9CE: psql_scan_slash_option
(psqlscanslash.l:563)
==00:00:00:04.045 3226182==    by 0x1206B6: exec_command_help
(command.c:1493)
==00:00:00:04.045 3226182==    by 0x1252CD: exec_command (command.c:351)
==00:00:00:04.045 3226182==    by 0x1258A3: HandleSlashCmds
(command.c:222)
==00:00:00:04.045 3226182==    by 0x13B166: MainLoop (mainloop.c:502)
==00:00:00:04.045 3226182==    by 0x1238B3: process_file (command.c:3921)
==00:00:00:04.045 3226182==    by 0x14357A: main (startup.c:400)
==00:00:00:04.045 3226182== 
{
   <insert_a_suppression_name_here>
   Memcheck:Cond
   fun:helpSQL
   fun:exec_command_help
   fun:exec_command
   fun:HandleSlashCmds
   fun:MainLoop
   fun:process_file
   fun:main
}
No help available for "\".
Try \h with no arguments to see available help.

psql is started with the following command line:
valgrind --leak-check=no --track-origins=yes --time-stamp=yes
--read-var-info=yes  \
 --gen-suppressions=all --suppressions=src/tools/valgrind.supp \
 --trace-children=yes $PGROOT/usr/local/pgsql/bin/psql


pgsql-bugs by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Bug in error reporting for multi-line JSON
Next
From: Thomas Munro
Date:
Subject: Re: BUG #16827: macOS interrupted syscall leads to a crash