Re: BUG #8821: pg_trgm segfault with Turkish locale database

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ufuk(at)paralaus(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8821: pg_trgm segfault with Turkish locale database
Date: 2014-01-13 16:09:45
Message-ID: 10064.1389629385@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

ufuk(at)paralaus(dot)com writes:
> Given a database with encoding UTF-8, locale tr_TR.UTF-8, 'pg_trgm'
> extension enabled, and the following setup:

> CREATE TABLE car_makers (maker TEXT);
> INSERT INTO car_makers VALUES ('AUDI'), ('MINI');

> Run any one of the following commands:

> - SELECT maker <-> 'MAZDA' FROM car_makers;
> - SELECT similarity(maker, 'MAZDA') FROM car_makers;
> - SELECT show_trgm('III');

> As a result, it seems there is a problem with trigrams generation and/or
> comparison when the Turkish locale is being used.

It looks like generate_trgm() is not considering the possibility that
case-folding will make the string physically longer, so you get a buffer
overrun when any of these I-containing strings are converted to trigrams.
Will fix, thanks for the report!

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Ufuk Kayserilioglu 2014-01-13 16:17:13 Re: BUG #8821: pg_trgm segfault with Turkish locale database
Previous Message Pavel Stehule 2014-01-13 15:11:53 Re: BUG #8822: What's the work around for the following exception?