Re: BUG #16837: Invalid memory access on \h in psql
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2021-01-26T16:11:22Z
Lists: pgsql-bugs
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
Commits
-
Code review for psql's helpSQL() function.
- f76a85000bba 14.0 landed
- 82f97d33f4d9 12.6 landed
- 64bdb6e5f845 13.2 landed
- 564cb2579afa 10.16 landed
- 3fa7b9078f28 11.11 landed
- 2c2e134b735f 9.6.21 landed
- 131825cd50a8 9.5.25 landed