Re: Bug: Reading from single byte character column type may cause out of bounds memory reads.

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Aleksander Alekseev <aleksander(at)timescale(dot)com>
Cc: Spyridon Dimitrios Agathos <spyridon(dot)dimitrios(dot)agathos(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Bug: Reading from single byte character column type may cause out of bounds memory reads.
Date: 2022-07-13 19:46:17
Message-ID: ddab080d-8c31-19af-e1e7-dba6c95d89a3@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2022-07-13 We 11:11, Tom Lane wrote:
> Aleksander Alekseev <aleksander(at)timescale(dot)com> writes:
>> Although the bug is easy to fix for this particular case (see the
>> patch) I'm not sure if this solution is general enough. E.g. is there
>> something that generally prevents pg_mblen() from doing out of bound
>> reading in cases similar to this one? Should we prevent such an INSERT
>> from happening instead?
> This is ultimately down to char_text() generating a string that's alleged
> to be a valid "text" type value, but it contains illegally-encoded data.
> Where we need to fix it is there: if we try to make every single
> text-using function be 100% bulletproof against wrongly-encoded data,
> we'll still be fixing bugs at the heat death of the universe.
>
> I complained about this in [1], but that thread died off before reaching a
> clear consensus about exactly what to do.
>
> regards, tom lane
>
> [1] https://www.postgresql.org/message-id/flat/2318797.1638558730%40sss.pgh.pa.us
>
>

Looks like the main controversy was about the output format. Make an
executive decision and pick one.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-07-13 19:49:34 Re: allow building trusted languages without the untrusted versions
Previous Message Nikita Malakhov 2022-07-13 19:45:40 Re: Pluggable toaster