Re: function lca('{}'::ltree[]) caused DB Instance crash

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: function lca('{}'::ltree[]) caused DB Instance crash
Дата
Msg-id 993.1531492016@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: function lca('{}'::ltree[]) caused DB Instance crash  (Pierre Ducroquet <p.psql@pinaraf.info>)
Ответы Re: function lca('{}'::ltree[]) caused DB Instance crash  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Pierre Ducroquet <p.psql@pinaraf.info> writes:
> On Friday, July 13, 2018 12:09:20 PM CEST 李海龙 wrote:
>> contrib_regression=# select lca('{}'::ltree[]);
>> server closed the connection unexpectedly

> There is indeed a bug. The _lca function in _ltree_op.c tries to allocate 0 
> bytes of memory, doesn't initialize it and dereference it in lca_inner.
> The attached basic patch fixes it.

I think the defense ought to be in lca_inner not there.

However, I don't understand why this code is returning NULL, rather than
a zero-length ltree, in the case that there's no common prefix.  That
doesn't seem consistent to me.

            regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: GiST VACUUM
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: [PATCH] Include application_name in "connection authorized" logmessage