Re: BUG #8702: psql \df+ translate_columns[] overflow and unexpected gettext translation - Mailing list pgsql-bugs

From Peter Eisentraut
Subject Re: BUG #8702: psql \df+ translate_columns[] overflow and unexpected gettext translation
Date
Msg-id 1388202637.18242.3.camel@vanquo.pezone.net
Whole thread Raw
In response to BUG #8702: psql \df+ translate_columns[] overflow and unexpected gettext translation  (eshkinkot@gmail.com)
Responses Re: BUG #8702: psql \df+ translate_columns[] overflow and unexpected gettext translation  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Fri, 2013-12-27 at 00:00 +0000, eshkinkot@gmail.com wrote:
> I get this result from \df+ foo:
> --- echo $LANG
> --- ru_RU.UTF-8
> ---
> --- create function foo() returns void language plpgsql as $$ begin end $$;

> src/bin/psql/describe.c:describeFunctions translate_columns[] array size
> is less than the maximum number of columns in query and it overflowed in
> src/bin/psql/print.c:printQuery at
> ...
>             translate = (opt->translate_columns &&
> opt->translate_columns[c]);
> ...
> so in my case opt->translate_columns[10] have garbage == true and
> "Description" field
> content translated unexpectedly.

There are several places that are similarly broken.  See attached patch.

Obviously, this is not a very robust programming interface, if the same
mistake has been repeated three times independently.


Attachment

pgsql-bugs by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: BUG #8676: Bug Money JSON
Next
From: Tom Lane
Date:
Subject: Re: to_number nl_NL.utf8