pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16837: Invalid memory access on \h in psql
Date: Tue, 26 Jan 2021 11:11:22 -0500
Message-ID: <2176557.1611677482@sss.pgh.pa.us> (raw)
In-Reply-To: <20210126.201709.717799732421886750.horikyota.ntt@gmail.com>
References: <16837-479bcd56040c71b3@postgresql.org>
	<20210126.201709.717799732421886750.horikyota.ntt@gmail.com>

Kyotaro Horiguchi <horikyota.ntt@gmail.com> writes:
> At Tue, 26 Jan 2021 07:00:00 +0000, PG Bug reporting form <noreply@postgresql.org> wrote in 
>> 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)

> This is reproducible on master HEAD. helpSQL assumes that the first
> word is longer than two characters and the second word exists. It also
> doesn't care overruns. Addition to those issues, it miscounts the
> length of the first two words if the third word exists.

Weirdly, valgrind isn't whining about this for me.  But I agree that
that loop is unsafe.  There are other problems too I think: neither
the initialization of "output" nor the calculation of nl_count seem
to be done sanely.  This function really needs thoroughgoing review :-(

			regards, tom lane





view thread (4+ messages)  latest in thread

Message-ID: <2176557.1611677482@sss.pgh.pa.us>
Permalink:  ../2176557.1611677482@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2176557.1611677482@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, horikyota.ntt@gmail.com, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #16837: Invalid memory access on \h in psql
  In-Reply-To: <2176557.1611677482@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox