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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16837: Invalid memory access on \h in psql
Date: 2021-01-26 16:11:22
Message-ID: 2176557.1611677482@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2021-01-27 00:35:04 Re: BUG #16794: BEFORE UPDATE FOR EACH ROW triggers on partitioned tables can break tuple moving UPDATEs
Previous Message Tobias Gierke 2021-01-26 15:19:37 Re: Assignment to composite type variable fails inside function but running query separately yields correct type & value ?