BUG #16837: Invalid memory access on \h in psql

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: exclusion(at)gmail(dot)com
Subject: BUG #16837: Invalid memory access on \h in psql
Date: 2021-01-26 07:00:00
Message-ID: 16837-479bcd56040c71b3@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16837
Logged by: Alexander Lakhin
Email address: exclusion(at)gmail(dot)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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2021-01-26 08:26:03 Re: BUG #16827: macOS interrupted syscall leads to a crash
Previous Message Simon Riggs 2021-01-25 13:08:15 Re: Bug in error reporting for multi-line JSON